Details
-
Bug
-
Resolution: Cannot Reproduce
-
P2: Important
-
None
-
4.6.0
Description
There are some possible bugs that cause problems when Qt is used from within a library. I.e. there is a main-application executable that isn't linking to Qt but loads a DLL that is using Qt. E.g. a Java virtual machine loading a Qt-using extension DLL would be such a case.
Qt's global statics (Q_GLOBAL_STATIC, etc.) are constructed on demand in the thread that needs them. Usually in the GUI thread. In the above case they are destroyed in the thread closes the last handle to the Qt-using library causing also the Qt libraries to be detached.
Question 1: Should it be safe to close the last handle to a Qt-using library in any thread? In other words, is it a bug if constructing a global static in Qt in one thread and then destroying it in another thread causes a crash?
Attached are a simple main()-application and a DLL that can be used to reproduce a crash that occurs when the last handle to a Qt-using library is closed in a non-GUI thread. The crash happens in ~QFontDatabasePrivate(). See the file qtfontdatabase.txt for call stack created with the attached app.
Question 2: When Qt is used in a library then there is a crash always in ~QS60PluginResolver() when the library is unloaded. See the file qtpluginresolver.txt for call stack created with the attached app. This happens even when everything is run in the main()-thread. Is this a bug?