Index: egg-recent-model.c
===================================================================
RCS file: /cvs/gnome/gnome-panel/gnome-panel/egg-recent-model.c,v
retrieving revision 1.11
diff -u -p -r1.11 egg-recent-model.c
--- egg-recent-model.c	25 Jan 2005 20:10:29 -0000	1.11
+++ egg-recent-model.c	26 Feb 2005 10:43:07 -0000
@@ -570,16 +570,17 @@ egg_recent_model_filter (EggRecentModel 
 
 		if (pass_mime_test && pass_group_test && pass_scheme_test)
 			newlist = g_list_prepend (newlist, item);
+		else
+			egg_recent_item_unref (item);
 
 		g_free (uri);
 	}
 
-	if (newlist) {
+	if (newlist)
 		newlist = g_list_reverse (newlist);
-		g_list_free (list);
-	}
 
-	
+	g_list_free (list);
+
 	return newlist;
 }
 
@@ -742,11 +743,16 @@ egg_recent_model_read (EggRecentModel *m
 	}
 
 	error = NULL;
-	if (!g_markup_parse_context_end_parse (ctx, &error))
+	if (!g_markup_parse_context_end_parse (ctx, &error)) {
+		g_warning (error->message);
+		g_error_free (error);
+		error = NULL;
 		goto out;
+	}
 	
-	g_markup_parse_context_free (ctx);
 out:
+	g_markup_parse_context_free (ctx);
+
 	list = info.items;
 
 	parse_info_free (&info);
@@ -958,6 +964,10 @@ egg_recent_model_finalize (GObject *obje
 					    model->priv->expiration_change_notify_id);
 	model->priv->expiration_change_notify_id = 0;
 
+	if (model->priv->client)
+		gconf_client_remove_dir (model->priv->client,
+					 EGG_RECENT_MODEL_KEY_DIR, NULL);
+
 	g_object_unref (model->priv->client);
 	model->priv->client = NULL;
 
@@ -967,7 +977,6 @@ egg_recent_model_finalize (GObject *obje
 	
 	g_hash_table_destroy (model->priv->monitors);
 	model->priv->monitors = NULL;
-
 
 	g_free (model->priv);
 }
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	26 Feb 2005 10:43:07 -0000
@@ -47,6 +47,7 @@ struct _EggRecentViewGtk {
 	gboolean trailing_sep;
 
 	gulong changed_cb_id;
+	gulong destroy_cb_id;
 
 	gchar *uid;
 
@@ -311,6 +312,7 @@ egg_recent_view_gtk_add_to_menu (EggRece
 	g_return_if_fail (view);
 	g_return_if_fail (view->menu);
 
+	menu_item = NULL;
 	menu_offset = egg_recent_view_gtk_find_menu_offset (view);
 
 	if (item != NULL)
@@ -388,11 +390,12 @@ egg_recent_view_gtk_set_model (EggRecent
 	g_return_if_fail (view_parent != NULL);
 	view = EGG_RECENT_VIEW_GTK (view_parent);
 
-	if (view->model != NULL) {
-		g_object_unref (view->model);
-		g_signal_handler_disconnect (G_OBJECT (model),
+	if (view->changed_cb_id)
+		g_signal_handler_disconnect (G_OBJECT (view->model),
 					     view->changed_cb_id);
-	}
+
+	if (view->model != NULL)
+		g_object_unref (view->model);
 	
 	view->model = model;
 	g_object_ref (view->model);
@@ -492,19 +495,40 @@ 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->destroy_cb_id)
+		g_signal_handler_disconnect (G_OBJECT (view->menu),
+					     view->destroy_cb_id);
+	view->destroy_cb_id = 0;
 
-	g_free (view->uid);
+	if (view->menu)
+		g_object_unref (view->menu);
+	view->menu = NULL;
+
+	if (view->changed_cb_id)
+		g_signal_handler_disconnect (G_OBJECT (view->model),
+					     view->changed_cb_id);
+	view->changed_cb_id = 0;
+
+	if (view->model)
+		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
@@ -598,6 +622,11 @@ static void
 egg_recent_view_gtk_init (EggRecentViewGtk * view)
 {
 	view->client = gconf_client_get_default ();
+	view->menu = NULL;
+	view->model = NULL;
+
+	view->changed_cb_id = 0;
+	view->destroy_cb_id = 0;
 
 	view->show_icons =
 		gconf_client_get_bool (view->client,
@@ -612,7 +641,6 @@ egg_recent_view_gtk_init (EggRecentViewG
 			(GConfClientNotifyFunc)show_menus_changed_cb,
 			view, NULL, NULL);
 
-
 	view->leading_sep = FALSE;
 	view->trailing_sep = FALSE;
 
@@ -638,7 +666,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 +726,20 @@ egg_recent_view_gtk_set_menu (EggRecentV
 	g_return_if_fail (EGG_IS_RECENT_VIEW_GTK (view));
 	g_return_if_fail (menu);
 
+	if (view->destroy_cb_id)
+		g_signal_handler_disconnect (G_OBJECT (view->menu),
+					     view->destroy_cb_id);
+
 	if (view->menu != NULL)
 		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);
 }
 
 /**
