[patch] a (temp?) fix for unexpected behaviour of KService::createInstance() on Windows

David Faure faure at kde.org
Mon Mar 3 13:15:18 GMT 2008

On Sunday 02 March 2008, Jarosław Staniek wrote:
> Attached a (temp?) patch for unexpected behaviour of 
> KService::createInstance() on Windows.
> The problem was that the lines:
>   KPluginLoader pluginLoader(*this);
>   KPluginFactory *factory = pluginLoader.factory();
> resulted with factory==0 for the first call, while another call worked well.
> People reported that on various windows (xp, vista) and builds (msvc, mingw).
> It was also possible that you execute an app for the first time, and 
> factory==0 (thus plugins, say, in KDE-PIM refused to load), then execute the 
> app again and factory is !=0.
> This is all I can have as a temporary solution for now. Feel free to improve - 
> hopefully at KPluginLoader level itself. I wasn't able to fix at KPluginLoader 
> inherits directly from QPluginLoader, so the ctor itself would have to be 
> executed twice...
... but that, too, would be a workaround.

You ask, but you should know what kind of answer you'll get, no? The right thing to do
is to find the real cause for this problem. I have seen many Qt-4-based commercial products
running on Windows just fine, including the opening of plugins; heck, designer itself opens
a large amount of plugins. Surely it doesn't execute QPluginLoader twice?
So: either those people get the same problem in Qt designer and it's a Qt bug,
or you/they need to find out what makes a difference between Qt (working) and KDE (not working) for them.

David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).

More information about the kde-core-devel mailing list