As discussed in https://bugs.kde.org/show_bug.cgi?id=363753 :
Qt has a long-standing issue where attempts to disconnect from DBus during global destruction can happen when the QtDBus internals have already been destroyed. A Qt patch exists that protects against this situation but until further notice it has to be applied by users and distribution maintainers.
There is another potential issue during global destruction if no disconnection from DBus is performed (a usual approach): DBus signals can arrive and be processed when the style plugin has already been dlclose'd. This jumps into unmapped memory space, leading to a crash.
This revision proposes a patch based on Debian's workaround. It attempts to prevent the DBus issues on exit in 2 ways:
- disconnect in reaction to QCoreApplication::aboutToQuit()
- delete all Style instances before unloading the plugin to avoid dangling references to unmapped memory.
The 2nd version of the patch includes a fix for a regression in Qt 5.9.0 (possibly a latent issue already present in earlier versions) that will be fixed only in Qt 5.9.1 . This is not related to DBus but is also caused by insufficient checking to avoid accessing (global) structures after they were deleted.