Bug 384466 - Crash running on a QGuiApplication
Summary: Crash running on a QGuiApplication
Status: RESOLVED FIXED
Alias: None
Product: frameworks-qqc2-desktop-style
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Marco Martin
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-09-07 12:44 UTC by Albert Astals Cid
Modified: 2017-09-22 15:14 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Albert Astals Cid 2017-09-07 12:44:29 UTC
I'm running some qml tests on some non public code (sorry) and got this crash. valgrind trace follows

==27797== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==27797==  Access not within mapped region at address 0x0
==27797==    at 0x21E6FE06: KQuickStyleItem::initStyleOption() (kquickstyleitem.cpp:588)
==27797==    by 0x21E69DE2: KQuickStyleItem::sizeFromContents(int, int) (kquickstyleitem.cpp:779)
==27797==    by 0x21E6A9C4: KQuickStyleItem::updateSizeHint() (kquickstyleitem.cpp:977)
==27797==    by 0x21E6DF71: KQuickStyleItem::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (moc_kquickstyleitem_p.cpp:612)
==27797==    by 0x7599801: ??? (in /usr/lib/libQt5Qml.so.5.9.1)
==27797==    by 0x7620418: ??? (in /usr/lib/libQt5Qml.so.5.9.1)
==27797==    by 0x76236D5: ??? (in /usr/lib/libQt5Qml.so.5.9.1)
==27797==    by 0x7624E68: ??? (in /usr/lib/libQt5Qml.so.5.9.1)
==27797==    by 0x762175F: ??? (in /usr/lib/libQt5Qml.so.5.9.1)
==27797==    by 0x7622504: ??? (in /usr/lib/libQt5Qml.so.5.9.1)
==27797==    by 0x7624BA9: ??? (in /usr/lib/libQt5Qml.so.5.9.1)
==27797==    by 0x7624E68: ??? (in /usr/lib/libQt5Qml.so.5.9.1)
==27797==  If you believe this happened as a result of a stack
==27797==  overflow in your program's main thread (unlikely but
==27797==  possible), you can try to increase the size of the
==27797==  main thread stack using the --main-stacksize= flag.
==27797==  The main thread stack size used in this run was 8388608.


I think this is on tear down, so may be that you're trying to update something that is not there anymore?
Comment 1 Albert Astals Cid 2017-09-07 13:24:55 UTC
So we've dicovered this is because my application is a QGuiApplication and this code uses qApp->style() quite a lot, and that will crash, so either this needs to stop using qApp->style() or the plugin itself should not load if the app is a QGuiApplication instead of a QApplication
Comment 2 David Edmundson 2017-09-22 15:14:20 UTC
Git commit 1781d60b230c32977c078e2943d94c506d7ee645 by David Edmundson.
Committed on 22/09/2017 at 15:14.
Pushed by davidedmundson into branch 'Plasma/5.11'.

Set QtQuickControls theme in QPT

Summary:
Currently we set QT_QUICK_CONTROLS_STYLE in startkde.

This causes problems as we're setting vars that meddle with other
developers setups. Especially if they're using QGuiApplication which
will instantly crash when using the desktop theme.

By moving the setting inside the QPT we can:
- only affect QApplications
- only affect apps that are desktopSettingsAware

If this env is already explicitly set by someone else, that has
precedence.

Also if this ever does move from being an env variable, we will probably
want to add the code here.
Related: bug 384481

Test Plan:
Unset env
Ran systemsettings5 the scrollbar was the correct colour

Reviewers: #plasma, gladhorn

Reviewed By: #plasma, gladhorn

Subscribers: gladhorn, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D7935

M  +15   -0    src/platformtheme/kdeplatformtheme.cpp
M  +1    -0    src/platformtheme/kdeplatformtheme.h

https://commits.kde.org/plasma-integration/1781d60b230c32977c078e2943d94c506d7ee645