PDA

View Full Version : Segmentation Fault after plugin was unloaded



zzz9
29th September 2011, 18:56
I have written application that manages plugins. When unload plugin by button click, everything is ok, debugger says that module is unloaded. Then I try to work in the program, just open standart open file dialog and it crashes at its exec() function. Debugger points at qmetaobject.h file. The error stays when I try to open other dialogs, my own dialogs.

Does someone have any ideas about this error?

Added after 1 14 minutes:

Maybe, QPluginLoader unloads something else that is needed for application work. But debugger says nothing about that only that plugin dll was unloaded.

ChrisW67
30th September 2011, 02:09
Have you destroyed every object that used the plugin before you unloaded it? Are you holding pointers, now invalid, to anything in the unloaded plugin?

zzz9
30th September 2011, 22:19
I've unloaded plugin just before doing something in the program, no objects were created. Moreover, QFileDialog doesn't deal with the plugin.
I think it will be good idea to test qt plugin framework on a simple example, so I'll write about the result.

wysota
1st October 2011, 16:00
What does your plugin do?

zzz9
2nd October 2011, 21:35
In simple applications everything works ok.


What does your plugin do?
Plugin creates a widget in a constructor. Application only tries to get plugin instance and add it to the list.

wysota
2nd October 2011, 23:37
Plugin shouldn't create any widgets in its constructor, you should have a separate method for that. Anyway... what does the plugin do in its destructor? Who is the parent of the widget? Does the widget get destroyed when the plugin is unloaded?

zzz9
3rd October 2011, 17:41
Plugin shouldn't create any widgets in its constructor, you should have a separate method for that. Anyway... what does the plugin do in its destructor? Who is the parent of the widget? Does the widget get destroyed when the plugin is unloaded?
Destructor is empty. There is no parent for the widget when it is created, I add it into layout later. I destroy the widget before unloading.
... Just tried the program one more time with the new version of the plugin. Everything works fine. Thanks for replies.