changeset 93030:d38f7962c052

(free_frame_tool_bar): Only call gtk_container_remove if handlebox_widget is != 0.
author Jan Djärv <jan.h.d@swipnet.se>
date Mon, 17 Mar 2008 07:18:47 +0000
parents 79e38938597d
children fda739bbfe8c
files src/gtkutil.c
diffstat 1 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkutil.c	Mon Mar 17 02:38:26 2008 +0000
+++ b/src/gtkutil.c	Mon Mar 17 07:18:47 2008 +0000
@@ -4139,9 +4139,16 @@
 
   if (x->toolbar_widget)
     {
+      int is_packed = x->handlebox_widget != 0;
       BLOCK_INPUT;
-      gtk_container_remove (GTK_CONTAINER (x->vbox_widget),
-                            x->handlebox_widget);
+      /* We may have created the toolbar_widget in xg_create_tool_bar, but
+         not the x->handlebox_widget which is created in xg_pack_tool_bar.  */
+      if (is_packed)
+        gtk_container_remove (GTK_CONTAINER (x->vbox_widget),
+                              x->handlebox_widget);
+      else
+        gtk_widget_destroy (x->toolbar_widget);
+
       x->toolbar_widget = 0;
       x->handlebox_widget = 0;
       FRAME_TOOLBAR_HEIGHT (f) = 0;