kioclient5 crashes on exit due to ~QDBusConnectionManager
David Faure
faure at kde.org
Sun Jun 1 11:48:38 UTC 2014
On Monday 12 May 2014 09:18:11 David Faure wrote:
> Does Qt really unload plugins? That would be the problem, right?
> We have an alive object in an unloaded plugin, and we're trying to call a
> method on it.
So the issue is that the widget style (QApplicationPrivate::app_style) doesn't get deleted
because that's done in the QApplication destructor which isn't run when calling ::exit(1).
On the other hand, the plugin object does get deleted, so a (fix? workaround?) would be this patch:
diff --git a/kstyle/oxygenstyle.cpp b/kstyle/oxygenstyle.cpp
index c9d7fef..972e4c8 100644
--- a/kstyle/oxygenstyle.cpp
+++ b/kstyle/oxygenstyle.cpp
@@ -165,6 +165,12 @@ namespace Oxygen
if( key.toLower() == QStringLiteral( "oxygen" ) ) return new Style();
else return nullptr;
}
+ Oxygen::StylePlugin::~StylePlugin()
+ {
+ // Delete style when using ::exit() otherwise it'll outlive the unloaded plugin and we'll get a crash
+ if (qApp)
+ delete qApp->style();
+ }
//_____________________________________________________________________
bool TopLevelManager::eventFilter( QObject *object, QEvent *event )
diff --git a/kstyle/oxygenstyle.h b/kstyle/oxygenstyle.h
index 94953fd..24eabe8 100644
--- a/kstyle/oxygenstyle.h
+++ b/kstyle/oxygenstyle.h
@@ -97,6 +97,7 @@ namespace Oxygen
StylePlugin(QObject *parent = 0):
QStylePlugin(parent)
{}
+ ~StylePlugin();
//! create style
QStyle* create( const QString& );
What do you think?
--
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE Frameworks 5
More information about the Kde-frameworks-devel
mailing list