How to correctly unload QApplication in a DLL?
-
Yes, qApp can be NULL (from documentation: Returns a pointer to the application's QCoreApplication (or QApplication) instance. If no instance has been allocated, null is returned). But don't focus on that, If I change the code like this, problem is the same.
@int argc = 0;
myApplication = new QApplication(argc, NULL);...
delete myApplication;@
-
I think you would get better answers on the interest mailing list. People fluent in QtCore code are likely to know the cause of your problem.
-
Anyway scenario is very complex since you are using a static object in process with another application (autocad) and managing a QApplication using qApp that can have different scope and logic behind.
Can you tell me why are you using QApplication and if you remove those instructions if it is working -
AlterX QObject class requires a valid QCoreApplication instance to work properly.
-
Ok, so due to this problem can be related to in process plugin, it is very hard to help you since we don't know how to reproduce this on our own. Maybe you can try to not unload the entire plugin and reload it, and have a only one instance of QApplication created when you load plugin? Can you do this?
-
[quote author="sierdzio" date="1417515370"]AlterX QObject class requires a valid QCoreApplication instance to work properly.[/quote]
Yes I know of course, but since he spoke about just an example I was thinking that original code was not using Qt and that this was just a curious question for him