Qt/MFC Migration Framework tool: properly exiting DLL?

Posted by User on Stack Overflow See other posts from Stack Overflow or by User
Published on 2011-02-25T00:54:32Z Indexed on 2011/03/01 23:24 UTC
Read the original article Hit count: 288

Filed under:
|
|
|
|

I'm using the Qt/MFC Migration Framework tool following this example: http://doc.qt.nokia.com/solutions/4/qtwinmigrate/winmigrate-qt-dll-example.html

The dll I build is loaded by a 3rd party MFC-based application. The 3rd party app basically calls one of my exported DLL functions to startup my plugin and another function to shutdown my application. Currently I'm doing nothing in my shutdown function.

When I load my DLL in the 3rd party app the startup function is called and my DLL starts successfully and I can see my message box. However if I shutdown my plugin and then try to start it again I get the following error:

Debug Error!

Program: <my 3rd party app>
Module: 4.7.1
File: global\qglobal.cpp
Line: 2262
ASSERT failure in QWidget: "Widgets must be created in the GUI
thread.", file kernel\qwidget.cpp line 1233

(Press Retry to debug the application)

Abort Retry Ignore

This makes me think I'm not doing something to properly shutdown my plugin. What do I need to do to shut it down properly?

UPDATE: http://doc.qt.nokia.com/solutions/4/qtwinmigrate/winmigrate-walkthrough.html says:

The DLL also has to make sure that it can be loaded together with other Qt based DLLs in the same process (in which case a QApplication object will probably exist already), and that the DLL that creates the QApplication object remains loaded in memory to avoid other DLLs using memory that is no longer available to the process.

So I wonder if there is some problem where I need to somehow keep the original DLL loaded no matter what?

© Stack Overflow or respective owner

Related posts about c++

Related posts about qt