Summary: | qqc2-desktop-style crashing when QApplication::style() returns NULL | ||
---|---|---|---|
Product: | [Frameworks and Libraries] frameworks-qqc2-desktop-style | Reporter: | RJVB <rjvbertin> |
Component: | general | Assignee: | Marco Martin <notmart> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | kde |
Priority: | NOR | ||
Version: | 5.47.0 | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | All | ||
Latest Commit: | https://commits.kde.org/qqc2-desktop-style/1e02355c178600e89b8c45e6232b2a2dc811ccc6 | Version Fixed In: | |
Sentry Crash Report: | |||
Attachments: | possible crash avoidance |
Description
RJVB
2018-07-07 21:13:15 UTC
It will. Don't use QQC2-desktop-style without a QApplication as it needs the QStyle. Well, that really puts a huge damper on using this plugin; setting QT_QUICK_CONTROLS_STYLE=org.kde.desktop means random (from the user's PoV) applications will start to crash. Letting code crash like this is really sloppy too, IMHO. Apparently it's not possible to let the style plugin deactivate itself when `qApp->style() == NULL`, but it can at least provoke a more or less clean application exit by not registering anything in registerTypes. And maybe it's not that expensive to let the style become a big NOOP in this situation. Created attachment 113842 [details]
possible crash avoidance
This is a simple workaround to prevent applications from crashing.
I haven't found a more elegant workaround (like a fallback to the default QQ2 style) but IMHO this still beats letting the code dereference null pointers knowingly.
Patch makes sense. Maybe QApplication::style as its static and qApp isn't a QApplication. Ship it. Git commit 1e02355c178600e89b8c45e6232b2a2dc811ccc6 by René J.V. Bertin. Committed on 24/11/2018 at 09:35. Pushed by rjvbb into branch 'master'. Support for QGuiApplication-based apps Wraps qApp->style() and creates a QStyle instance of the user's preferred widget style if qApp->style() returns null. This makes it safe to set QT_QUICK_CONTROLS_STYLE=org.kde.desktop and still run applications based on QuickControls2 (QGuiApplication) without crashing. Differential Revision: https://phabricator.kde.org/D14000 M +139 -117 plugin/kquickstyleitem.cpp M +7 -2 plugin/kquickstyleitem_p.h https://commits.kde.org/qqc2-desktop-style/1e02355c178600e89b8c45e6232b2a2dc811ccc6 |