Comments on: Experiencing unexpected crashes to desktop on WED on Windows 10? Here’s why… https:/2017/04/experiencing-unexpected-crashes-to-desktop-on-windows-10-heres-why/ Developer resources for the X-Plane flight simulator Sat, 15 Apr 2017 22:07:42 +0000 hourly 1 https://wordpress.org/?v=6.6.1 By: xibo https:/2017/04/experiencing-unexpected-crashes-to-desktop-on-windows-10-heres-why/#comment-19416 Sat, 15 Apr 2017 22:07:42 +0000 http://xplanedev.wpengine.com/?p=7602#comment-19416 In reply to Ulrich.

Note that cutting out individual codepoints – or even worse bytes – from a string can cause the string to corrupt. Strangs are made out of graphemes, which can each be made out of multiple unicode codepoints, which can each be made out of multiple unicode surrogate codepoints, which can each be made out of multiple bytes. The wide string functions from the C (and C++) runtime library do not apply a normalization when transforming the input, and therefore will output surrogate codepoints if surrogates were used in the input, which is very common.

Attempting to print a string that contains broken unicode can cause undefined behaviour due to bugs in the implementations: Over here, I have Qt misrendering the complete string, Java same, Win32 leaking memory and misrendering all characters past the broken one and pangocairo entering an infinite loop on a number of sample inputs the other day.

Instead, if a string needs modification, it has to be modified on grapheme level.

]]>
By: Saso Kiselkov https:/2017/04/experiencing-unexpected-crashes-to-desktop-on-windows-10-heres-why/#comment-19361 Thu, 13 Apr 2017 08:18:39 +0000 http://xplanedev.wpengine.com/?p=7602#comment-19361 In reply to Ben Supnik.

Thank you.

]]>
By: Ben Supnik https:/2017/04/experiencing-unexpected-crashes-to-desktop-on-windows-10-heres-why/#comment-19349 Thu, 13 Apr 2017 01:19:31 +0000 http://xplanedev.wpengine.com/?p=7602#comment-19349 In reply to Saso Kiselkov.

No. The X-Plane SDK API bindings will remain pure C, even though the underlying implementation has always been C++ internally; we do this so that other languages can link more easily.

I am referring to trying to keep small parts of the scenery tools/WED code base C-only. We’re going to accept that scenery tools is all c++ and replace the C string handling.

]]>
By: Saso Kiselkov https:/2017/04/experiencing-unexpected-crashes-to-desktop-on-windows-10-heres-why/#comment-19348 Wed, 12 Apr 2017 22:47:04 +0000 http://xplanedev.wpengine.com/?p=7602#comment-19348 In reply to Ben Supnik.

Please clarify, are you talking about the X-Plane API being rewritten in C++? I really kind of enjoyed it being in C, since I’m using it from a C plugin.

]]>
By: Ulrich https:/2017/04/experiencing-unexpected-crashes-to-desktop-on-windows-10-heres-why/#comment-19340 Wed, 12 Apr 2017 15:25:17 +0000 http://xplanedev.wpengine.com/?p=7602#comment-19340 On the truncation solution: I had a similar problem when creating audio file names from the track title, and I solved it similarly, but a bit different: First I decided to truncate the middle part, because the “ends” may have relevant data. For example the track title “Beethoven: Symphony No. 3 ‘Eroica’, op. 55 – Marcia funebre (Adagio assai)” became file name “4.02 Beethoven- Symphony No. 3 ‘Eroica’,…ebre (Adagio assai).ogg”. This shows the second improvement: I was worried wasting three characters for the ellipsis, so I used _one_ Unicode character that contains the three dots, saving two valuable characters 😉

]]>
By: Ben Supnik https:/2017/04/experiencing-unexpected-crashes-to-desktop-on-windows-10-heres-why/#comment-19337 Wed, 12 Apr 2017 13:36:13 +0000 http://xplanedev.wpengine.com/?p=7602#comment-19337 In reply to Patrick Vollebregt.

I don’t usually use the term “beautifully” with anything Qt related. 🙂

]]>
By: Ben Supnik https:/2017/04/experiencing-unexpected-crashes-to-desktop-on-windows-10-heres-why/#comment-19336 Wed, 12 Apr 2017 13:35:53 +0000 http://xplanedev.wpengine.com/?p=7602#comment-19336 In reply to Christian Loose.

There were a few reasons:
1. We wrote our abstraction first, then others brought in QT, so by the time it was available the work was already done.
2. I am not a huge QT fan, and wasn’t looking to have the QT tool chain on Mac/Windows.

]]>
By: Christian Loose https:/2017/04/experiencing-unexpected-crashes-to-desktop-on-windows-10-heres-why/#comment-19335 Wed, 12 Apr 2017 10:42:08 +0000 http://xplanedev.wpengine.com/?p=7602#comment-19335 In reply to Ben Supnik.

Since Qt is already an abstraction for all OS and window managers (Linux, Windows, OS X), why not use it for all and drop your own abstractions?

]]>
By: Patrick Vollebregt https:/2017/04/experiencing-unexpected-crashes-to-desktop-on-windows-10-heres-why/#comment-19333 Wed, 12 Apr 2017 06:44:08 +0000 http://xplanedev.wpengine.com/?p=7602#comment-19333 In reply to Ben Supnik.

Why use Qt only for Linux? It solves the crossplatform problem beautifully.

]]>
By: Ben Supnik https:/2017/04/experiencing-unexpected-crashes-to-desktop-on-windows-10-heres-why/#comment-19328 Tue, 11 Apr 2017 23:12:08 +0000 http://xplanedev.wpengine.com/?p=7602#comment-19328 In reply to Igor.

You mean WED?

– Qt is used for the Linux abstraction of the OS and window manager.
– Win32 is used for the Win32 abstraction of the OS and window manager.
– ObjC/Cocoa is used for the OS X abstraction of the OS and window manager. How could you LEAVE THIS OFF in your list of scary – it’s the most scary part of all. 🙂
– The plain C is legacy from a million years ago when I thought it would be useful for some low level utility APIs to be pure C so they could be compiled into a wider range of projects.

Since no one really uses that last capability we now have a policy of rewriting to C++ and removing C string handling whenever possible, to minimize C string face-palms. But the boundary with the Win32 API is one of those areas where we just have to do it right.

]]>