Index: egg-recent-view-gtk.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/egg-recent-view-gtk.c,v
retrieving revision 1.7
diff -u -p -r1.7 egg-recent-view-gtk.c
--- egg-recent-view-gtk.c	25 Jan 2005 20:10:29 -0000	1.7
+++ egg-recent-view-gtk.c	25 Feb 2005 09:26:14 -0000
@@ -47,6 +47,7 @@ struct _EggRecentViewGtk {
 	gboolean trailing_sep;
 
 	gulong changed_cb_id;
+	gulong destroy_cb_id;
 
 	gchar *uid;
 
@@ -389,9 +390,9 @@ egg_recent_view_gtk_set_model (EggRecent
 	view = EGG_RECENT_VIEW_GTK (view_parent);
 
 	if (view->model != NULL) {
-		g_object_unref (view->model);
 		g_signal_handler_disconnect (G_OBJECT (model),
 					     view->changed_cb_id);
+		g_object_unref (view->model);
 	}
 	
 	view->model = model;
@@ -492,19 +493,36 @@ egg_recent_view_gtk_finalize (GObject *o
 {
 	EggRecentViewGtk *view = EGG_RECENT_VIEW_GTK (object);
 
-	g_signal_handler_disconnect (G_OBJECT (view->model),
-				     view->changed_cb_id);
+	if (view->uid)
+		g_free (view->uid);
+	view->uid = NULL;
+
+	if (view->menu) {
+		g_signal_handler_disconnect (G_OBJECT (view->menu),
+					     view->destroy_cb_id);
+		g_object_unref (view->menu);
+	}
+	view->menu = NULL;
 
-	g_free (view->uid);
+	if (view->model) {
+		g_signal_handler_disconnect (G_OBJECT (view->model),
+					     view->changed_cb_id);
+		g_object_unref (view->model);
+	}
+	view->model = NULL;
 
-	g_object_unref (view->menu);
-	g_object_unref (view->model);
 #ifndef USE_STABLE_LIBGNOMEUI
-	g_object_unref (view->theme);
+	if (view->theme)
+		g_object_unref (view->theme);
+	view->theme = NULL;
 #endif
-	g_object_unref (view->client);
-
-	g_object_unref (view->tooltips);
+	if (view->client)
+		g_object_unref (view->client);
+	view->client = NULL;
+
+	if (view->tooltips)
+		g_object_unref (view->tooltips);
+	view->tooltips = NULL;
 }
 
 static void
@@ -638,7 +656,8 @@ egg_recent_view_gtk_set_icon_size (EggRe
 {
 	if (view->icon_size != icon_size) {
 		view->icon_size = icon_size;
-		egg_recent_model_changed (view->model);
+		if (view->model)
+			egg_recent_model_changed (view->model);
 	} else {
 		view->icon_size = icon_size;
 	}
@@ -697,11 +716,19 @@ egg_recent_view_gtk_set_menu (EggRecentV
 	g_return_if_fail (EGG_IS_RECENT_VIEW_GTK (view));
 	g_return_if_fail (menu);
 
-	if (view->menu != NULL)
+	if (view->menu != NULL) {
+		g_signal_handler_disconnect (G_OBJECT (view->menu),
+					     view->destroy_cb_id);
 		g_object_unref (view->menu);
+	}
 	
 	view->menu = menu;
 	g_object_ref (view->menu);
+
+	view->destroy_cb_id = g_signal_connect (G_OBJECT (view->menu),
+						"destroy",
+						G_CALLBACK (gtk_widget_destroyed),
+						&view->menu);
 }
 
 /**
