Kate crash on exit - windows only?
Matthias Kretz
kretz at kde.org
Sun Mar 2 14:45:05 GMT 2008
On Saturday 01 March 2008, Christian Ehrlicher wrote:
> kdelibs_kate.patch
> 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;
No static non-POD objects in libs (and also better not in apps)! You can use
K_GLOBAL_STATIC instead.
> +static void cleanupKPluginFactoryList()
> +{
> + Q_FOREACH(KPluginFactory *f, s_KPluginFactoryList)
> + delete f;
you could use qDeleteAll
> +}
> +
> 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();
> }
I'd do it this way:
struct KTextEditorFactoryList : public QList
{
KTextEditorFactoryList();
~KTextEditorFactoryList() { qDeleteAll(*this); }
};
K_GLOBAL_STATIC(KTextEditorFactoryList, s_factoryList)
KTextEditorFactoryList::KTextEditorFactoryList
{
qAddPostRoutine(s_factoryList.destroy);
}
then in ::editor you only need to add:
*s_factoryList += ef;
--
________________________________________________________
Matthias Kretz (Germany) <><
http://Vir.homelinux.org/
MatthiasKretz at gmx.net, kretz at kde.org,
Matthias.Kretz at urz.uni-heidelberg.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20080302/4ecb66e8/attachment.sig>
More information about the kde-core-devel
mailing list