[gimp/soc-2010-cage] app: remove the dockables manually in dispose()
- From: Michael Muré <mmure src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/soc-2010-cage] app: remove the dockables manually in dispose()
- Date: Wed, 30 Jun 2010 22:16:52 +0000 (UTC)
commit 285d7692aa4dbf87e8d3ebf8f550f5bd8bec6e78
Author: Michael Natterer <mitch gimp org>
Date: Sat Jun 26 23:23:50 2010 +0200
app: remove the dockables manually in dispose()
using the proper API, so all stuff is properly disconnected and the
list items managing them are freed to. Also make removing robust
against dockbook->dock being NULL.
app/widgets/gimpdockbook.c | 20 ++++++++++++--------
1 files changed, 12 insertions(+), 8 deletions(-)
---
diff --git a/app/widgets/gimpdockbook.c b/app/widgets/gimpdockbook.c
index dada344..580c112 100644
--- a/app/widgets/gimpdockbook.c
+++ b/app/widgets/gimpdockbook.c
@@ -307,6 +307,9 @@ gimp_dockbook_dispose (GObject *object)
gimp_dockbook_remove_tab_timeout (dockbook);
+ while (dockbook->p->dockables)
+ gimp_dockbook_remove (dockbook, dockbook->p->dockables->data);
+
G_OBJECT_CLASS (parent_class)->dispose (object);
}
@@ -989,8 +992,6 @@ void
gimp_dockbook_remove (GimpDockbook *dockbook,
GimpDockable *dockable)
{
- GList *children;
-
g_return_if_fail (GIMP_IS_DOCKBOOK (dockbook));
g_return_if_fail (GIMP_IS_DOCKABLE (dockable));
g_return_if_fail (gimp_dockable_get_dockbook (dockable) == dockbook);
@@ -1020,14 +1021,17 @@ gimp_dockbook_remove (GimpDockbook *dockbook,
g_object_unref (dockable);
- gimp_dockbook_update_auto_tab_style (dockbook);
-
- children = gtk_container_get_children (GTK_CONTAINER (dockbook));
+ if (dockbook->p->dock)
+ {
+ GList *children = gtk_container_get_children (GTK_CONTAINER (dockbook));
- if (! g_list_length (children))
- gimp_dock_remove_book (dockbook->p->dock, dockbook);
+ if (children)
+ gimp_dockbook_update_auto_tab_style (dockbook);
+ else
+ gimp_dock_remove_book (dockbook->p->dock, dockbook);
- g_list_free (children);
+ g_list_free (children);
+ }
}
/**
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]