pluginType dialog doesn't seem to terminate upon closing

• Jan 19, 2016 - 21:01

Both on 2.0.2 and master on Win7:

1. Open Plugin Creator
2. Load helloqml plugin
3. Run it from the Plugin Creator
4. Close it by clicking within the dialog
-> all is OK, run/stop buttons look OK
5. Run it again
6. Close the dialog by using the close button
-> run/stop buttons remain as if the plugin is still running.

Now I'm wondering whether the plugin is not exited/closed as it should, or if the Plugin Creator misses that way of terminating a plugin and simply 'forgets' to update its button state.

EDIT: quick debugging makes me believe the Plugin Creator doesn't get/handle the close signal from the dialog, which would mean the plugin probably does terminate as intended.


Comments

Something is quite off, at least when running plugins from the Plugin Creator.

Setting a breakpoint in void PluginCreator::closePlugin() shows that the function is indeed not called when using the close button from the dialog.
Furthermore it also shows that the function is called the same amount of times as you've ran the plugin from within the creator.

This leads me into thinking that the plugin isn't destroyed when it calls Qt.Quit() (and perhaps it shouldn't be, open for suggestions). But each time you click run, a new QQmlComponent, QQuickView (and possibly QDockWidget) is instantiated, while the previous instance is lingering somewhere.
Each time, the quit signal from the qml engine is attached the same handler as well:
connect(qml, SIGNAL(quit()), SLOT(closePlugin()));
which explains the multiple calls to closePlugin.

Proposed fixes:
1. disconnect closePlugin from qml.quit in closePlugin -> prevent multiple calls
2. figure out why the view isn't destroyed when quitting, possibly destroy it in closePlugin
-> what other items would need cleanup? the underlying QQmlComponent?
3. figure out the correct signal to listen to from a dialog and connect that one to closePlugin (possibly the QQuickWindow::closing signal)

Do you still have an unanswered question? Please log in first to post your question.