In a recent version of Xcode (26.1) release builds would crash the
unittest runner during any tests using a std::vector<char32_t> where
its data was reinterpreted as const CharPointer_UTF32::CharType*.
Similar attempts were made to update the UTF8 a UTF16 tests,
unfortunately avoiding a reinterpret_cast for UTF16 isn't as easy
because CharPointer_UTF16 uses a signed integer type which makes the
test data more awkward to work with.
There's a few things going on in this commit:
- The implementation of CharPointer_UTF16 now uses helpers from
CharacterFunctions to avoid a few instances of magic numbers.
- Where it makes sense, member functions of that class have been DRYed
by e.g. implementing getAndAdvance in terms of operator*() and
operator++().
- Added more tests for incrementing/decrementing/dereferencing
CharPointer_UTF16.
After this change, a CharPointer_UTF16 that points to an unpaired
surrogate will always dereference to a 32-bit character with that
surrogate's value.
Note that dereferencing a CharPointer_UTF16 that points to a high
surrogate at the final code unit in a memory region is inherently
unsafe, because CharPointer_UTF16 can't track its own size, and the
dereference operation will check the following code unit to see whether
it is a low surrogate.
This may be due to a bug in the macOS SDK but the user facing
versions of these preprocessor definitions are returning the
incorrect details for at least the macOS 26 SDK
ObjCClass doesn't have other virtual methods; it is not intended to be
used as an interface or dynamic type. Removing the virtual destructor
is intended to promote composition over inheritance when using this
type.
This bug could be observed in the DemoRunner:
- Enable "button" navigation mode (as opposed to "gesture" mode) on the
Android device.
- Remove the line enabling kiosk mode, build and install the DemoRunner.
- Run the app and navigate to the Settings pane. Open a menu, or the
bluetooth MIDI dialog window, then close the popup window.
- Rotate the device.
Previously, the steps above could result in the system painting its own
backgrounds behind the system bars. With this patch in place, we reset
the requested system UI colours and transparency, which seems to
maintain the desired appearance.
Regarding didComplete():
When a WebInputStream is destroyed, the thread of execution will wait in
SharedSession::removeTask() until the task is no longer present in the
list of all active tasks. If multiple threads are all waiting in
removeTask(), then all of those threads should wake when the set of
active tasks changes. Waking only a single thread may result in
deadlocks, as that thread's task may not have completed successfully.
Then, the thread that woke up will be forced to sleep again and may not
get another chance to wake.
Regarding didBecomeInvalid():
Normally, didBecomeInvalid() will only be called after the
SharedSession's destructor. If the destructor is running, we may assume
that no other thread can access the SharedSession, so using notify_one()
in didBecomeInvalid() should be sufficient to wake up the destructor's
thread. However, there's a chance that the NSURLSession may be
invalidated unexpectedly (i.e. before the SharedSession's destructor
runs), in which case there may still be threads waiting in removeTask().
In this scenario we need to notify_all() so that all waiting threads are
able to wake and make progress.