Closed GoogleCodeExporter closed 9 years ago
It's because the code in the destroy event is checking that all widgets have
been destroyed before exiting but 1 remains when including a menu. My test app
had 6 widgets without menubar+menu+menuitem but 10 with!
Original comment by thunor...@hotmail.com
on 10 Aug 2012 at 1:23
Right, I've got a handle on this now.
Each widget has an associated variable -- user defined or autogenerated -- that
is stored in an array. When closing via the closewindow action function or the
window manager, functions are executed that attempt to nullify variables
attached to that particular window. The problem is the use of
gtk_widget_get_toplevel() to match the variable being nullified to the window
being closed: the menu widget is also a toplevel widget so what happens is that
menuitem widgets don't get removed because their parent is the menu and not the
window and they get left in the array causing these functions to assume that
there's another window open.
There is a fix for this which I've been using because it was recommended and
now I understand what's happening. <action signal="hide">exit:Exit</action>
kills the application that refuses to close because the normal exit command
quits the entire application so it's not checking that the variable array is
empty.
I should be able to fix this with gtk_widget_get_ancestor(widget,
GTK_TYPE_WINDOW).
Original comment by thunor...@hotmail.com
on 10 Aug 2012 at 5:13
What a nightmare!
Having used gtk_widget_get_parent() to dump a widget's family tree to the
terminal I can see that the menuitems have two unknown ancestors and then nil.
They can't be traced back to the window, so this is a problem. The GtkMenuItems
are contained in a GtkMenuShell->GtkMenu which is attached to a GtkMenuItem on
the GtkMenuBar, so it's the GtkMenuShell->GtkMenu that's causing the problem.
Original comment by thunor...@hotmail.com
on 11 Aug 2012 at 10:24
Fixed in r346.
Original comment by thunor...@hotmail.com
on 12 Aug 2012 at 4:25
Original issue reported on code.google.com by
thunor...@hotmail.com
on 9 Aug 2012 at 11:49