summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <[email protected]>2016-08-27 10:40:38 +0200
committerHugo Pereira Da Costa <[email protected]>2016-09-21 14:17:57 +0200
commit9b3d268f5f36ce7a635875223469bc4e8e2b3542 (patch)
treea9e73f4884ab9685c2fadadb67403f3fcceb2b88
parent15baa19ecf4a25dbf55d30abbcc7abb76d1be22b (diff)
Fix crash on exit
Since Qt 5.6.0, Qt5 applications started crashing on exit. All signs point to this delete-on-destroy hack which was added to avoid outliving the plugin lifetime. This method is wrong because the returned style is owned by the caller (QApplication, QProxyStyle, etc) and will cleaned up when those users are destructed. Review: 128760
-rw-r--r--kstyle/breezestyleplugin.cpp10
1 files changed, 1 insertions, 9 deletions
diff --git a/kstyle/breezestyleplugin.cpp b/kstyle/breezestyleplugin.cpp
index 083100e..bcb10de 100644
--- a/kstyle/breezestyleplugin.cpp
+++ b/kstyle/breezestyleplugin.cpp
@@ -35,15 +35,7 @@ namespace Breeze
{
if( key.toLower() == QStringLiteral( "breeze" ) )
{
- QStyle* style = new Style();
- #if QT_VERSION >= 0x050000
- // Delete style when using ::exit() otherwise it'll outlive the unloaded plugin and we'll get a crash
- // (see 2ffe20e1bfe93c921c5372b4d21447b1de308d4b in oxygen repo)
- connect(this, &QObject::destroyed, style, [style]() {
- delete style;
- });
- #endif
- return style;
+ return new Style;
}
return nullptr;
}