--- gtkhandlebox.c.bak	2003-06-24 20:00:39.000000000 +0900
+++ gtkhandlebox.c	2003-06-24 21:03:19.000000000 +0900
@@ -29,6 +29,7 @@
 #include "gtkhandlebox.h"
 #include "gtkmain.h"
 #include "gtkmarshalers.h"
+#include "gtkselection.h"
 #include "gtkwindow.h"
 #include "gtkintl.h"
 
@@ -501,15 +502,33 @@
 {
   GtkHandleBox *hb = GTK_HANDLE_BOX (widget);
 
+  if (GTK_WIDGET_MAPPED (widget) && GTK_WIDGET_CLASS (parent_class)->unmap)
+    GTK_WIDGET_CLASS (parent_class)->unmap (widget);
+
+  GTK_WIDGET_UNSET_FLAGS (widget, GTK_MAPPED);
+
+  if (GTK_IS_CONTAINER (widget))
+    gtk_container_forall (GTK_CONTAINER (widget),
+			  (GtkCallback) gtk_widget_unrealize,
+			  NULL);
+
+  gtk_style_detach (widget->style);
+
   gdk_window_set_user_data (hb->bin_window, NULL);
   gdk_window_destroy (hb->bin_window);
   hb->bin_window = NULL;
+
   gdk_window_set_user_data (hb->float_window, NULL);
   gdk_window_destroy (hb->float_window);
   hb->float_window = NULL;
 
-  if (GTK_WIDGET_CLASS (parent_class)->unrealize)
-    (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
+  gdk_window_set_user_data (widget->window, NULL);
+  gdk_window_destroy (widget->window);
+  widget->window = NULL;
+
+  gtk_selection_remove_all (widget);
+  
+  GTK_WIDGET_UNSET_FLAGS (widget, GTK_REALIZED);
 }
 
 static void
