How to correctly kill plugins with their windows?
-
Main application loads bunch of plugins. Most of them have their own UIs and windows appear on screen. When application ends I have close all plugins window and kill all plugins threads if any running. I'm thinking how better do that... As I see - when I close main app window but plugins window exist (even one) - then application is still running. Probably all loaded plugins run too. All finishes when I close last window regardless of is it main window or plugin window. I'm going create a set of slots in plugins to connect them to on_MainWindow_destroyed() signals. And connect them between plugins to allow any of them close others. But I'm not sure - will this correctly close application and destroy all plugins when last window close? Anybody can comment this?
-
If you shutdown the mainwindow, all childwindows will be destroyed, too. If you got some instances of YourClass, created with new, you have to delete them yourself or use smartpointers.
-
And child of childs, too!
-
I did not tell - plugins windows are not children of main app window. They are independent windows without parent. They should work on different monitors. Without parent/child relation to main window they are not closed with it.
-
for while I created little complex network of signals emited from closeEvent() overloaded methods, and slots to close each other window in it's own manner with confirmation to main window, looks like all works fine