[Interest] calling QMessageBox::warning() may break the DLL detaching on VS2010

Xulei xulei1981 at 126.com
Wed Nov 7 03:57:39 CET 2012

Hi All,

I’m developing a project with Qt4.8.3 on Win7/VS2010. I found a critical issue when calling QMessagebox::warning (actually, information(), critical() have the same issue too, but question() not). To duplicate the issue according the following steps:

1.       Create a “Qt Application” project (named QtTest) in VS2010 by Qt Add-in with default settings.

2.       Add an action, and call QMessageBox::warning() in its slots.

3.       Create another DLL project (named MyDll) in VS2010, with a single export function (named foo).

4.       Call the exported function “foo” in QtTest project.

5.       Call ::MessageBox of Windows API in “DllMain” of MyDll project to show whether the DllMain with DLL_PROCESS_DETACH is called when program exiting.

6.       Start the QtTest.exe, then exit, the ::MessageBox in DllMain of MyDll will be called.

7.       Start the QtTest.exe, then trigger the action create in step#2, then exit, the MessageBox in DllMain of MyDll will not be called.


Note, the issue may not be duplicate on very PC, I had tested more than 10 PCs, and about half PCs could duplicate this issue.

As you know, when the DLL detach is not called, the other cleanup work won’t work too, such as destructors of local static objects and global objects won’t be called.

The URL is the source code I mentioned above.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20121107/cb80e526/attachment.html>

More information about the Interest mailing list