Implemented proper bin destruction on the GTK+ backend.
This commit is contained in:
parent
732d13aa09
commit
a15bb12ad1
|
@ -104,9 +104,14 @@ void binSetParent(uiContainer *c, uintptr_t osParent)
|
|||
{
|
||||
struct bin *b = (struct bin *) c;
|
||||
GtkWidget *widget;
|
||||
GtkContainer *newContainer;
|
||||
GtkContainer *newContainer, *oldContainer;
|
||||
|
||||
widget = GTK_WIDGET(uiControlHandle(uiControl(b)));
|
||||
if (osParent == 0) {
|
||||
oldContainer = GTK_CONTAINER(gtk_widget_get_parent(widget));
|
||||
gtk_container_remove(oldContainer, widget);
|
||||
return;
|
||||
}
|
||||
newContainer = GTK_CONTAINER(osParent);
|
||||
gtk_container_add(newContainer, widget);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ static void onDestroy(void *data)
|
|||
// we need to remove them from the tab first; see below
|
||||
for (i = 0; i < t->pages->len; i++) {
|
||||
p = &g_array_index(t->pages, struct tabPage, i);
|
||||
// this does the job of binSetParent()
|
||||
gtk_container_remove(t->container, p->binWidget);
|
||||
uiControlDestroy(uiControl(p->bin));
|
||||
}
|
||||
|
@ -75,6 +76,7 @@ static void tabDeletePage(uiTab *tt, uintmax_t n)
|
|||
// why? simple: both gtk_notebook_remove_tab() and gtk_widget_destroy() call gtk_container_remove()
|
||||
// we need to remove them from the tab first, though, otherwise they won't really be destroyed properly
|
||||
// (the GtkNotebook will still have the tab in it because its reference ISN'T destroyed, and we crash resizing a bin that no longer exists
|
||||
// this also does the job of binSetParent()
|
||||
gtk_container_remove(t->container, p->binWidget);
|
||||
uiControlDestroy(uiControl(p->bin));
|
||||
|
||||
|
|
|
@ -46,7 +46,8 @@ static void windowDestroy(uiControl *c)
|
|||
// first hide ourselves
|
||||
gtk_widget_hide(w->widget);
|
||||
// now destroy the bin
|
||||
// the bin has no parent, so we can just call uiControlDestroy()
|
||||
// we need to remove the bin from its parent first
|
||||
binSetParent(w->bin, 0);
|
||||
uiControlDestroy(uiControl(w->bin));
|
||||
// now destroy the menus, if any
|
||||
if (w->menubar != NULL)
|
||||
|
|
Loading…
Reference in New Issue