[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-core-devel
Subject: Re: Kate crash on exit - windows only?
From: Christian Ehrlicher <Ch.Ehrlicher () gmx ! de>
Date: 2008-03-01 20:50:40
Message-ID: 47C9C1A0.9010906 () gmx ! de
[Download RAW message or body]
[Attachment #2 (multipart/mixed)]
Christian Ehrlicher schrieb:
> David Faure schrieb:
>> On Thursday 28 February 2008, Christian Ehrlicher wrote:
>>> Hi,
>>>
>>> Kate crashes on exit due to weird (?) unloading behaviour. I can see
>>> that qt_call_post_routines() is already executed and
>>> KServiceTypeFactory is destroyed. Later
>>> QObjectCleanupHandler/KPluginFactory is destroyed and katepart lib
>>> gets unloaded. During the unload, KatePartPluginManager dtor is executed
>>
>> This is a memory leak in the application. This the katepart
>> pluginmanager should
>> be deleted much before QObjectCleanupHandler triggers.
>>
> Ok, thx for this information - I'll see how to fix it and post a patch
>
Here a fix.
kdelibs_kate.patch is the important one - it destroys the KPluginFactory
(and unloads libktexteditor) before Q(Core)Application is gone. This
solves my crash on windows.
kdesdk.patch adds some delete statements to properly clean up some objects.
Christian
["kdelibs_kate.patch" (text/x-diff)]
Index: interfaces/ktexteditor/ktexteditor.cpp
===================================================================
--- interfaces/ktexteditor/ktexteditor.cpp (revision 780993)
+++ interfaces/ktexteditor/ktexteditor.cpp (working copy)
@@ -188,14 +188,28 @@
return KService::createInstance<KTextEditor::Plugin>(service, parent);
}
+static QList<KPluginFactory*> s_KPluginFactoryList;
+static void cleanupKPluginFactoryList()
+{
+ Q_FOREACH(KPluginFactory *f, s_KPluginFactoryList)
+ delete f;
+}
+
Editor *KTextEditor::editor(const char *libname)
{
KPluginFactory *fact=KPluginLoader(libname).factory();
KTextEditor::Factory *ef=qobject_cast<KTextEditor::Factory*>(fact);
- if (!ef) return 0;
+ if (!ef) {
+ delete fact;
+ return 0;
+ }
+ if(s_KPluginFactoryList.count() == 0)
+ qAddPostRoutine(cleanupKPluginFactoryList);
+ s_KPluginFactoryList += fact;
+
return ef->editor();
}
["kdesdk.patch" (text/x-diff)]
Index: kate/app/kateapp.cpp
===================================================================
--- kate/app/kateapp.cpp (revision 780903)
+++ kate/app/kateapp.cpp (working copy)
@@ -72,11 +72,17 @@
KateApp::~KateApp ()
{
+ // cu session manager
+ delete m_sessionManager;
+
// cu plugin manager
delete m_pluginManager;
// delete this now, or we crash
delete m_docManager;
+
+ // cu kate app
+ delete m_application;
}
KateApp *KateApp::self ()
Index: kate/app/katedocmanager.cpp
===================================================================
--- kate/app/katedocmanager.cpp (revision 780903)
+++ kate/app/katedocmanager.cpp (working copy)
@@ -102,6 +102,8 @@
qDeleteAll( m_docInfos );
delete m_metaInfos;
+ delete m_documentManager;
+ // delete m_editor; don't delete this here - it's cleaned up when the plugin is unloaded
}
KateDocManager *KateDocManager::self ()
["signature.asc" (application/pgp-signature)]
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic