diff --git a/gnome-panel/panel-object-loader.c b/gnome-panel/panel-object-loader.c
index 4480c95..00e7fa2 100644
--- a/gnome-panel/panel-object-loader.c
+++ b/gnome-panel/panel-object-loader.c
@@ -109,10 +109,15 @@ panel_object_loader_stop_loading (const char *id)
 {
         PanelObjectToLoad *object;
         GSList *l;
+	char *tmp_id;
+
+	/* because the 'id' can come from object->id, and
+	   free_object_to_load() frees it, which makes 'id' invalid */
+	tmp_id = g_strdup (id);
 
         for (l = panel_objects_loading; l; l = l->next) {
                 object = l->data;
-                if (g_strcmp0 (object->id, id) == 0)
+                if (g_strcmp0 (object->id, tmp_id) == 0)
                         break;
         }
         if (l != NULL) {
@@ -122,7 +127,7 @@ panel_object_loader_stop_loading (const char *id)
 
         for (l = panel_objects_to_load; l; l = l->next) {
                 object = l->data;
-                if (g_strcmp0 (object->id, id) == 0)
+                if (g_strcmp0 (object->id, tmp_id) == 0)
                         break;
         }
         if (l != NULL) {
@@ -130,6 +135,8 @@ panel_object_loader_stop_loading (const char *id)
                 free_object_to_load (object);
         }
 
+	g_free (tmp_id);
+
         if (panel_objects_loading == NULL && panel_objects_to_load == NULL)
                 panel_object_loader_queue_initial_unhide_toplevels (NULL);
 }
