[Issue N207054] Frequent crashes on app quit due to dbus

Jaroslaw Staniek js at iidea.pl
Fri Apr 11 19:30:23 CEST 2008


qt-bugs at trolltech.com said the following, On 2008-04-11 17:29:

> I'm not aware of a working DBUS implementation for Windows that we would
> support yet, so I am tempted to suspect this to be a winDBUS problem
> rather than a Qt problem.
> 
> Static objects are at any rate a bad idea. Try to see if using a cleanup
> handler, or an explicit deinitialization routine (possibly through an
> implemenation of DllMain in kio) works better.

Volker,
It's windbus 1.1.2. We're rather well aware of the risk of using global 
objects, so we use K_GLOBAL_STATIC and qAddPostRoutine. I am attaching current 
example from kdelibs/interfaces/ktexteditor.cpp, in case I have misunderstood 
something:

struct KTextEditorFactoryList : public QList<KPluginFactory*>
{
   KTextEditorFactoryList();
   ~KTextEditorFactoryList();
};
K_GLOBAL_STATIC(KTextEditorFactoryList, s_factoryList)
KTextEditorFactoryList::KTextEditorFactoryList() {
   // K_GLOBAL_STATIC is cleaned up *after* Q(Core)Application is gone
   // but we have to cleanup before -> use qAddPostRoutine
   qAddPostRoutine(s_factoryList.destroy);
}
KTextEditorFactoryList::~KTextEditorFactoryList() {
   qRemovePostRoutine(s_factoryList.destroy); // post routine is installed!
   qDeleteAll(*this);
}

-- 
regards / pozdrawiam, Jaroslaw Staniek
  Sponsored by OpenOffice Polska (http://www.openoffice.com.pl/en) to work on
  Kexi & KOffice (http://www.kexi.pl/en, http://www.koffice.org/kexi)
  KDE Libraries for MS Windows (http://windows.kde.org)


More information about the Kde-windows mailing list