Bugfix: a standalone LayoutView object made the application crash on exit

Reason: at the Qt will destroy all top level widgets.
Ruby/Python will now know of this, hence try to cleanup
the object inside it's GC.

There was an attempt to avoid this by deleting all
top-level widgets before the application exits. But
this failed for LayoutView objects because these will
create other, dependet top-level widgets for the plugins.
And the LayoutView wants to stay owner for them.
This commit is contained in:
Matthias Koefferlein 2018-07-29 01:02:39 +02:00
parent 5fe0aca9c7
commit d378a632f3
1 changed files with 8 additions and 2 deletions

View File

@ -1399,10 +1399,16 @@ GuiApplication::shutdown ()
mp_mw = 0;
}
// delete all other top level widgets for safety - we don't want Ruby clean them up for us
// detach all top level widgets from Ruby/Python - we don't want the interpreter do this
// for us. Qt will delete all top level widgets itself.
// NOTE: we must only detach (= "keep" on C++ side), not delete them as top level widgets
// may be owned by someone else.
QWidgetList tl_widgets = topLevelWidgets ();
for (QWidgetList::iterator w = tl_widgets.begin (); w != tl_widgets.end (); ++w) {
delete *w;
gsi::ObjectBase *gsi_obj = dynamic_cast<gsi::ObjectBase *> (*w);
if (gsi_obj) {
gsi_obj->keep ();
}
}
if (mp_recorder) {