Index: gtk/gtkfilechooserbutton.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkfilechooserbutton.c,v
retrieving revision 1.51
diff -u -p -r1.51 gtkfilechooserbutton.c
--- gtk/gtkfilechooserbutton.c	10 Jul 2006 16:51:52 -0000	1.51
+++ gtk/gtkfilechooserbutton.c	19 Jul 2006 22:41:41 -0000
@@ -903,12 +903,14 @@ gtk_file_chooser_button_destroy (GtkObje
   if (priv->dnd_select_folder_handle)
     {
       gtk_file_system_cancel_operation (priv->dnd_select_folder_handle);
+      g_object_unref (priv->dnd_select_folder_handle);
       priv->dnd_select_folder_handle = NULL;
     }
 
   if (priv->update_button_handle)
     {
       gtk_file_system_cancel_operation (priv->update_button_handle);
+      g_object_unref (priv->update_button_handle);
       priv->update_button_handle = NULL;
     }
 
@@ -918,6 +920,7 @@ gtk_file_chooser_button_destroy (GtkObje
         {
           GtkFileSystemHandle *handle = GTK_FILE_SYSTEM_HANDLE (l->data);
           gtk_file_system_cancel_operation (handle);
+	   g_object_unref (handle);
         }
       g_slist_free (priv->change_icon_theme_handles);
       priv->change_icon_theme_handles = NULL;
@@ -973,15 +976,14 @@ dnd_select_folder_get_info_cb (GtkFileSy
 
   if (handle != data->button->priv->dnd_select_folder_handle)
     {
-      g_object_unref (data->button);
+      g_object_unref (data->button);
       gtk_file_path_free (data->path);
       g_strfreev (data->uris);
       g_free (data);
-
-      g_object_unref (handle);
       return;
     }
 
+  g_object_unref (handle);
   data->button->priv->dnd_select_folder_handle = NULL;
 
   if (!cancelled && !error && info != NULL)
@@ -999,12 +1001,10 @@ dnd_select_folder_get_info_cb (GtkFileSy
 
   if (data->selected || data->uris[++data->i] == NULL)
     {
-      g_object_unref (data->button);
+      g_object_unref (data->button);
       gtk_file_path_free (data->path);
       g_strfreev (data->uris);
       g_free (data);
-
-      g_object_unref (handle);
       return;
     }
 
@@ -1018,8 +1018,6 @@ dnd_select_folder_get_info_cb (GtkFileSy
     gtk_file_system_get_info (handle->file_system, data->path,
 			      GTK_FILE_INFO_IS_FOLDER,
 			      dnd_select_folder_get_info_cb, user_data);
-
-  g_object_unref (handle);
 }
 
 static void
@@ -1059,7 +1057,7 @@ gtk_file_chooser_button_drag_data_receiv
 	  break;
 
 	info = g_new0 (struct DndSelectFolderData, 1);
-	info->button = g_object_ref (button);
+	info->button = g_object_ref (button);
 	info->i = 0;
 	info->uris = uris;
 	info->selected = FALSE;
@@ -1069,7 +1067,10 @@ gtk_file_chooser_button_drag_data_receiv
 						  info->uris[info->i]);
 
 	if (priv->dnd_select_folder_handle)
-	  gtk_file_system_cancel_operation (priv->dnd_select_folder_handle);
+	  {
+	    gtk_file_system_cancel_operation (priv->dnd_select_folder_handle);
+	    g_object_unref (priv->dnd_select_folder_handle);
+	  }
 
 	priv->dnd_select_folder_handle =
 	  gtk_file_system_get_info (priv->fs, info->path,
@@ -1196,6 +1197,7 @@ change_icon_theme_get_info_cb (GtkFileSy
 
   data->button->priv->change_icon_theme_handles =
     g_slist_remove (data->button->priv->change_icon_theme_handles, handle);
+  g_object_unref (handle);
 
   if (cancelled || error)
     goto out;
@@ -1218,7 +1220,7 @@ change_icon_theme_get_info_cb (GtkFileSy
       gtk_list_store_set (GTK_LIST_STORE (data->button->priv->model), &iter,
 			  ICON_COLUMN, pixbuf,
 			  -1);
-      g_object_unref (pixbuf);
+      g_object_unref (pixbuf);
 
       g_object_set (data->button->priv->icon_cell,
 		    "width", width,
@@ -1226,11 +1228,9 @@ change_icon_theme_get_info_cb (GtkFileSy
     }
 
 out:
-  g_object_unref (data->button);
+  g_object_unref (data->button);
   gtk_tree_row_reference_free (data->row_ref);
   g_free (data);
-
-  g_object_unref (handle);
 }
 
 static void
@@ -1247,6 +1247,7 @@ change_icon_theme (GtkFileChooserButton 
     {
       GtkFileSystemHandle *handle = GTK_FILE_SYSTEM_HANDLE (l->data);
       gtk_file_system_cancel_operation (handle);
+      g_object_unref (handle);
     }
   g_slist_free (button->priv->change_icon_theme_handles);
   button->priv->change_icon_theme_handles = NULL;
@@ -1415,6 +1416,7 @@ set_info_get_info_cb (GtkFileSystemHandl
   gtk_list_store_set (GTK_LIST_STORE (data->button->priv->model), &iter,
 		      HANDLE_COLUMN, NULL,
 		      -1);
+  g_object_unref (model_handle);
 
   if (cancelled || error)
     /* There was an error, leave the fallback name in there */
@@ -1430,14 +1432,12 @@ set_info_get_info_cb (GtkFileSystemHandl
 		      -1);
 
   if (pixbuf)
-    g_object_unref (pixbuf);
+    g_object_unref (pixbuf);
 
 out:
-  g_object_unref (data->button);
+  g_object_unref (data->button);
   gtk_tree_row_reference_free (data->row_ref);
   g_free (data);
-
-  g_object_unref (handle);
 }
 
 static void
@@ -1450,7 +1450,7 @@ set_info_for_path_at_iter (GtkFileChoose
   GtkFileSystemHandle *handle;
 
   data = g_new0 (struct SetDisplayNameData, 1);
-  data->button = g_object_ref (button);
+  data->button = g_object_ref (button);
 
   tree_path = gtk_tree_model_get_path (button->priv->model, iter);
   data->row_ref = gtk_tree_row_reference_new (button->priv->model, tree_path);
@@ -1582,6 +1582,7 @@ model_add_special_get_info_cb (GtkFileSy
   gtk_list_store_set (GTK_LIST_STORE (data->button->priv->model), &iter,
 		      HANDLE_COLUMN, NULL,
 		      -1);
+  g_object_unref (model_handle);
 
   if (cancelled || error)
     goto out;
@@ -1602,11 +1603,9 @@ model_add_special_get_info_cb (GtkFileSy
 		      -1);
 
 out:
-  g_object_unref (data->button);
+  g_object_unref (data->button);
   gtk_tree_row_reference_free (data->row_ref);
   g_free (data);
-
-  g_object_unref (handle);
 }
 
 static inline void
@@ -1646,9 +1645,9 @@ model_add_special (GtkFileChooserButton 
 					 model_add_special_get_info_cb, info);
 
       gtk_list_store_set (store, &iter,
+			  TYPE_COLUMN, ROW_TYPE_SPECIAL,
 			  ICON_COLUMN, NULL,
 			  DISPLAY_NAME_COLUMN, NULL,
-			  TYPE_COLUMN, ROW_TYPE_SPECIAL,
 			  DATA_COLUMN, path,
 			  IS_FOLDER_COLUMN, TRUE,
 			  HANDLE_COLUMN, handle,
@@ -1693,6 +1692,7 @@ model_add_special (GtkFileChooserButton 
 			  DISPLAY_NAME_COLUMN, _(DESKTOP_DISPLAY_NAME),
 			  DATA_COLUMN, path,
 			  IS_FOLDER_COLUMN, TRUE,
+			  HANDLE_COLUMN, handle,
 			  -1);
 
       button->priv->n_special++;
@@ -2109,6 +2109,7 @@ update_label_get_info_cb (GtkFileSystemH
   if (handle != priv->update_button_handle)
     goto out;
 
+  g_object_unref (handle);
   priv->update_button_handle = NULL;
 
   if (cancelled || error)
@@ -2125,11 +2126,10 @@ update_label_get_info_cb (GtkFileSystemH
 
   gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image), pixbuf);
   if (pixbuf)
-    g_object_unref (pixbuf);
+    g_object_unref (pixbuf);
 
 out:
-  g_object_unref (button);
-  g_object_unref (handle);
+  g_object_unref (button);
 }
 
 static void
@@ -2177,13 +2177,16 @@ update_label_and_image (GtkFileChooserBu
 	}
 
       if (priv->update_button_handle)
-	gtk_file_system_cancel_operation (priv->update_button_handle);
+	{
+	  gtk_file_system_cancel_operation (priv->update_button_handle);
+	  g_object_unref (priv->update_button_handle);
+	}
 
       priv->update_button_handle =
         gtk_file_system_get_info (priv->fs, path,
 				  GTK_FILE_INFO_DISPLAY_NAME | GTK_FILE_INFO_ICON,
 				  update_label_get_info_cb,
-				  g_object_ref (button));
+				  g_object_ref (button));
     }
 out:
   gtk_file_paths_free (paths);
Index: gtk/gtkfilechooserdefault.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkfilechooserdefault.c,v
retrieving revision 1.328
diff -u -p -r1.328 gtkfilechooserdefault.c
--- gtk/gtkfilechooserdefault.c	18 Jul 2006 16:36:16 -0000	1.328
+++ gtk/gtkfilechooserdefault.c	19 Jul 2006 22:41:50 -0000
@@ -690,7 +690,10 @@ shortcuts_free_row_data (GtkFileChooserD
 		      -1);
 
   if (handle)
-    gtk_file_system_cancel_operation (handle);
+    {
+      gtk_file_system_cancel_operation (handle);
+      g_object_unref (handle);
+    }
 
   if (!col_data)
     return;
@@ -797,7 +800,7 @@ gtk_file_chooser_default_finalize (GObje
 
   shortcuts_free (impl);
 
-  g_object_unref (impl->file_system);
+  g_object_unref (impl->file_system);
 
   g_free (impl->browse_files_last_selected_name);
 
@@ -1105,6 +1108,7 @@ shortcuts_reload_icons_get_info_cb (GtkF
     goto out;
 
   data->impl->reload_icon_handles = g_slist_remove (data->impl->reload_icon_handles, handle);
+  g_object_unref (handle);
 
   if (cancelled || error)
     goto out;
@@ -1124,10 +1128,8 @@ shortcuts_reload_icons_get_info_cb (GtkF
 
 out:
   gtk_tree_row_reference_free (data->row_ref);
-  g_object_unref (data->impl);
+  g_object_unref (data->impl);
   g_free (data);
-
-  g_object_unref (handle);
 }
 
 static void
@@ -1145,6 +1147,7 @@ shortcuts_reload_icons (GtkFileChooserDe
     {
       GtkFileSystemHandle *handle = GTK_FILE_SYSTEM_HANDLE (l->data);
       gtk_file_system_cancel_operation (handle);
+      g_object_unref (handle);
     }
   g_slist_free (impl->reload_icon_handles);
   impl->reload_icon_handles = NULL;
@@ -1189,7 +1192,7 @@ shortcuts_reload_icons (GtkFileChooserDe
 	      path = data;
 
 	      info = g_new0 (struct ReloadIconsData, 1);
-	      info->impl = g_object_ref (impl);
+	      info->impl = g_object_ref (impl);
 	      tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL (impl->shortcuts_model), &iter);
 	      info->row_ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (impl->shortcuts_model), tree_path);
 	      gtk_tree_path_free (tree_path);
@@ -1358,6 +1361,7 @@ get_file_info_finished (GtkFileSystemHan
   gtk_list_store_set (request->impl->shortcuts_model, &iter,
 		      SHORTCUTS_COL_HANDLE, NULL,
 		      -1);
+  g_object_unref (handle);
 
   if (cancelled)
     goto out;
@@ -1422,14 +1426,12 @@ get_file_info_finished (GtkFileSystemHan
     g_object_unref (pixbuf);
 
 out:
-  g_object_unref (request->impl);
+  g_object_unref (request->impl);
   gtk_file_path_free (request->parent_path);
   gtk_file_path_free (request->path);
   gtk_tree_row_reference_free (request->row_ref);
   g_free (request->label_copy);
   g_free (request);
-
-  g_object_unref (handle);
 }
 
 /* Inserts a path in the shortcuts tree, making a copy of it; alternatively,
@@ -1466,7 +1468,7 @@ shortcuts_insert_path (GtkFileChooserDef
       GtkTreePath *p;
 
       request = g_new0 (struct ShortcutsInsertRequest, 1);
-      request->impl = g_object_ref (impl);
+      request->impl = g_object_ref (impl);
       request->path = gtk_file_path_copy (path);
       request->name_only = TRUE;
       request->removable = removable;
@@ -1911,6 +1913,8 @@ shortcuts_add_current_folder (GtkFileCho
 
       if (base_path)
 	gtk_file_path_free (base_path);
+      if (volume)
+	  gtk_file_system_volume_free (impl->file_system, volume);
     }
   else if (impl->save_folder_combo != NULL)
     gtk_combo_box_set_active (GTK_COMBO_BOX (impl->save_folder_combo), pos);
@@ -1967,7 +1971,7 @@ shortcuts_model_create (GtkFileChooserDe
 					      G_TYPE_BOOLEAN,   /* is the previous column a volume? */
 					      G_TYPE_BOOLEAN,   /* removable */
 					      G_TYPE_BOOLEAN,   /* pixbuf cell visibility */
-					      G_TYPE_OBJECT);   /* GtkFileSystemHandle */
+					      G_TYPE_POINTER);   /* GtkFileSystemHandle */
 
   if (impl->file_system)
     {
@@ -2029,6 +2033,7 @@ edited_idle_create_folder_cb (GtkFileSys
     goto out;
 
   impl->pending_handles = g_slist_remove (impl->pending_handles, handle);
+  g_object_unref (handle);
 
   if (cancelled)
     goto out;
@@ -2039,8 +2044,7 @@ edited_idle_create_folder_cb (GtkFileSys
     error_creating_folder_dialog (impl, path, g_error_copy (error));
 
  out:
-  g_object_unref (impl);
-  g_object_unref (handle);
+  g_object_unref (impl);
 }
 
 /* Idle handler for creating a new folder after editing its name cell, or for
@@ -2075,7 +2079,7 @@ edited_idle_cb (GtkFileChooserDefault *i
 
 	  handle = gtk_file_system_create_folder (impl->file_system, file_path,
 						  edited_idle_create_folder_cb,
-						  g_object_ref (impl));
+						  g_object_ref (impl));
 	  impl->pending_handles = g_slist_append (impl->pending_handles, handle);
 
 	  gtk_file_path_free (file_path);
@@ -3675,6 +3679,7 @@ file_list_drag_data_received_get_info_cb
     goto out;
 
   data->impl->file_list_drag_data_received_handle = NULL;
+  g_object_unref (handle);
 
   if (cancelled || error)
     goto out;
@@ -3700,12 +3705,10 @@ file_list_drag_data_received_get_info_cb
     file_list_drag_data_select_uris (data->impl, data->uris);
 
 out:
-  g_object_unref (data->impl);
+  g_object_unref (data->impl);
   g_strfreev (data->uris);
   gtk_file_path_free (data->path);
   g_free (data);
-
-  g_object_unref (handle);
 }
 
 static void
@@ -3740,12 +3743,15 @@ file_list_drag_data_received_cb (GtkWidg
 	  struct FileListDragData *data;
 
 	  data = g_new0 (struct FileListDragData, 1);
-	  data->impl = g_object_ref (impl);
+	  data->impl = g_object_ref (impl);
 	  data->uris = uris;
 	  data->path = path;
 
 	  if (impl->file_list_drag_data_received_handle)
-	    gtk_file_system_cancel_operation (impl->file_list_drag_data_received_handle);
+	    {
+	      gtk_file_system_cancel_operation (impl->file_list_drag_data_received_handle);
+	      g_object_unref (impl->file_list_drag_data_received_handle);
+	    }
 
 	  impl->file_list_drag_data_received_handle =
 	    gtk_file_system_get_info (impl->file_system, path,
@@ -4621,24 +4627,22 @@ static void
 set_extra_widget (GtkFileChooserDefault *impl,
 		  GtkWidget             *extra_widget)
 {
-  if (extra_widget)
-    {
-      g_object_ref (extra_widget);
-      /* FIXME: is this right ? */
-      gtk_widget_show (extra_widget);
-    }
+  if (extra_widget == impl->extra_widget)
+    return;
 
   if (impl->extra_widget)
     {
       gtk_container_remove (GTK_CONTAINER (impl->extra_align), impl->extra_widget);
-      g_object_unref (impl->extra_widget);
+      g_object_unref (impl->extra_widget);
     }
 
   impl->extra_widget = extra_widget;
   if (impl->extra_widget)
     {
       gtk_container_add (GTK_CONTAINER (impl->extra_align), impl->extra_widget);
+      gtk_widget_show (impl->extra_widget); /* FIXME: is this right ? */
       gtk_widget_show (impl->extra_align);
+      g_object_ref (impl->extra_widget);
     }
   else
     gtk_widget_hide (impl->extra_align);
@@ -5057,6 +5061,7 @@ gtk_file_chooser_default_dispose (GObjec
         {
 	  GtkFileSystemHandle *handle =l->data;
 	  gtk_file_system_cancel_operation (handle);
+	  g_object_unref (handle);
         }
       g_slist_free (impl->pending_handles);
       impl->pending_handles = NULL;
@@ -5068,6 +5073,7 @@ gtk_file_chooser_default_dispose (GObjec
         {
 	  GtkFileSystemHandle *handle =l->data;
 	  gtk_file_system_cancel_operation (handle);
+	  g_object_unref (handle);
         }
       g_slist_free (impl->reload_icon_handles);
       impl->reload_icon_handles = NULL;
@@ -5079,6 +5085,7 @@ gtk_file_chooser_default_dispose (GObjec
         {
 	  GtkFileSystemHandle *handle =l->data;
 	  gtk_file_system_cancel_operation (handle);
+	  g_object_unref (handle);
         }
       g_slist_free (impl->loading_shortcuts);
       impl->loading_shortcuts = NULL;
@@ -5087,36 +5094,42 @@ gtk_file_chooser_default_dispose (GObjec
   if (impl->file_list_drag_data_received_handle)
     {
       gtk_file_system_cancel_operation (impl->file_list_drag_data_received_handle);
+      g_object_unref (impl->file_list_drag_data_received_handle);
       impl->file_list_drag_data_received_handle = NULL;
     }
 
   if (impl->update_current_folder_handle)
     {
       gtk_file_system_cancel_operation (impl->update_current_folder_handle);
+      g_object_unref (impl->update_current_folder_handle);
       impl->update_current_folder_handle = NULL;
     }
 
   if (impl->show_and_select_paths_handle)
     {
       gtk_file_system_cancel_operation (impl->show_and_select_paths_handle);
+      g_object_unref (impl->show_and_select_paths_handle);
       impl->show_and_select_paths_handle = NULL;
     }
 
   if (impl->should_respond_get_info_handle)
     {
       gtk_file_system_cancel_operation (impl->should_respond_get_info_handle);
+      g_object_unref (impl->should_respond_get_info_handle);
       impl->should_respond_get_info_handle = NULL;
     }
 
   if (impl->update_from_entry_handle)
     {
       gtk_file_system_cancel_operation (impl->update_from_entry_handle);
+      g_object_unref (impl->update_from_entry_handle);
       impl->update_from_entry_handle = NULL;
     }
 
   if (impl->shortcuts_activate_iter_handle)
     {
       gtk_file_system_cancel_operation (impl->shortcuts_activate_iter_handle);
+      g_object_unref (impl->shortcuts_activate_iter_handle);
       impl->shortcuts_activate_iter_handle = NULL;
     }
 
@@ -5791,6 +5804,7 @@ show_and_select_paths_finished_loading (
   browse_files_center_selected_row (data->impl);
 
   gtk_file_paths_free (data->paths);
+  g_object_unref (data->impl);
   g_free (data);
 }
 
@@ -5807,12 +5821,11 @@ show_and_select_paths_get_folder_cb (Gtk
     goto out;
 
   data->impl->show_and_select_paths_handle = NULL;
+  g_object_unref (handle);
 
   if (cancelled || error)
     goto out;
 
-  g_object_unref (handle);
-
   if (gtk_file_folder_is_finished_loading (folder))
     show_and_select_paths_finished_loading (folder, user_data);
   else
@@ -5823,11 +5836,9 @@ show_and_select_paths_get_folder_cb (Gtk
   return;
 
 out:
-  g_object_unref (data->impl);
+  g_object_unref (data->impl);
   gtk_file_paths_free (data->paths);
   g_free (data);
-
-  g_object_unref (handle);
 }
 
 static gboolean
@@ -5847,11 +5858,14 @@ show_and_select_paths (GtkFileChooserDef
     }
 
   info = g_new (struct ShowAndSelectPathsData, 1);
-  info->impl = g_object_ref (impl);
+  info->impl = g_object_ref (impl);
   info->paths = gtk_file_paths_copy (paths);
 
   if (impl->show_and_select_paths_handle)
-    gtk_file_system_cancel_operation (impl->show_and_select_paths_handle);
+    {
+      gtk_file_system_cancel_operation (impl->show_and_select_paths_handle);
+      g_object_unref (impl->show_and_select_paths_handle);
+    }
 
   impl->show_and_select_paths_handle =
     gtk_file_system_get_folder (impl->file_system, parent_path,
@@ -6156,6 +6170,7 @@ update_current_folder_get_info_cb (GtkFi
     goto out;
 
   impl->update_current_folder_handle = NULL;
+  g_object_unref (handle);
   impl->reload_state = RELOAD_EMPTY;
 
   set_busy_cursor (impl, FALSE);
@@ -6222,8 +6237,6 @@ update_current_folder_get_info_cb (GtkFi
 out:
   gtk_file_path_free (data->path);
   g_free (data);
-
-  g_object_unref (handle);
 }
 
 static gboolean
@@ -6252,7 +6265,10 @@ gtk_file_chooser_default_update_current_
     }
 
   if (impl->update_current_folder_handle)
+  {
     gtk_file_system_cancel_operation (impl->update_current_folder_handle);
+    g_object_unref (impl->update_current_folder_handle);
+  }
 
   /* Test validity of path here.  */
   data = g_new0 (struct UpdateCurrentFolderData, 1);
@@ -6789,7 +6805,7 @@ add_shortcut_get_info_cb (GtkFileSystemH
   shortcuts_insert_path (data->impl, pos, FALSE, NULL, data->path, NULL, FALSE, SHORTCUTS_SHORTCUTS);
 
 out:
-  g_object_unref (data->impl);
+  g_object_unref (data->impl);
   gtk_file_path_free (data->path);
   g_free (data);
 
@@ -6848,7 +6864,7 @@ gtk_file_chooser_default_add_shortcut_fo
     }
 
   data = g_new0 (struct AddShortcutData, 1);
-  data->impl = g_object_ref (impl);
+  data->impl = g_object_ref (impl);
   data->path = gtk_file_path_copy (path);
 
   handle = gtk_file_system_get_info (impl->file_system, path,
@@ -6886,6 +6902,7 @@ gtk_file_chooser_default_remove_shortcut
         {
 	  impl->loading_shortcuts = g_slist_remove (impl->loading_shortcuts, h);
 	  gtk_file_system_cancel_operation (h);
+	  g_object_unref (h);
           return TRUE;
 	}
     }
@@ -7225,6 +7242,7 @@ confirmation_confirm_get_info_cb (GtkFil
     goto out;
 
   data->impl->should_respond_get_info_handle = NULL;
+  g_object_unref (handle);
 
   if (cancelled)
     goto out;
@@ -7240,11 +7258,9 @@ confirmation_confirm_get_info_cb (GtkFil
     g_signal_emit_by_name (data->impl, "response-requested");
 
 out:
-  g_object_unref (data->impl);
+  g_object_unref (data->impl);
   g_free (data->file_part);
   g_free (data);
-
-  g_object_unref (handle);
 }
 
 /* Does overwrite confirmation if appropriate, and returns whether the dialog
@@ -7273,11 +7289,14 @@ should_respond_after_confirm_overwrite (
 	g_assert (file_part != NULL);
 
 	data = g_new0 (struct GetDisplayNameData, 1);
-	data->impl = g_object_ref (impl);
+	data->impl = g_object_ref (impl);
 	data->file_part = g_strdup (file_part);
 
 	if (impl->should_respond_get_info_handle)
-	  gtk_file_system_cancel_operation (impl->should_respond_get_info_handle);
+	  {
+	    gtk_file_system_cancel_operation (impl->should_respond_get_info_handle);
+	    g_object_unref (impl->should_respond_get_info_handle);
+	  }
 
 	impl->should_respond_get_info_handle =
 	  gtk_file_system_get_info (impl->file_system, parent_path,
@@ -7325,7 +7344,7 @@ action_create_folder_cb (GtkFileSystemHa
     g_signal_emit_by_name (impl, "response-requested");
 
 out:
-  g_object_unref (impl);
+  g_object_unref (impl);
   g_object_unref (handle);
 }
 
@@ -7351,6 +7370,7 @@ save_entry_get_info_cb (GtkFileSystemHan
     goto out;
 
   data->impl->should_respond_get_info_handle = NULL;
+  g_object_unref (handle);
 
   set_busy_cursor (data->impl, FALSE);
 
@@ -7400,12 +7420,10 @@ save_entry_get_info_cb (GtkFileSystemHan
     }
 
 out:
-  g_object_unref (data->impl);
+  g_object_unref (data->impl);
   gtk_file_path_free (data->path);
   gtk_file_path_free (data->parent_path);
   g_free (data);
-
-  g_object_unref (handle);
 }
 
 static void
@@ -7618,13 +7636,16 @@ gtk_file_chooser_default_should_respond 
 	      parent_path = gtk_file_path_copy (_gtk_file_chooser_entry_get_current_folder (entry));
 
 	      data = g_new0 (struct SaveEntryData, 1);
-	      data->impl = g_object_ref (impl);
+	      data->impl = g_object_ref (impl);
 	      data->file_exists_and_is_not_folder = file_exists_and_is_not_folder;
 	      data->parent_path = parent_path; /* Takes ownership */
 	      data->path = gtk_file_path_copy (path);
 
 	      if (impl->should_respond_get_info_handle)
-		gtk_file_system_cancel_operation (impl->should_respond_get_info_handle);
+		{
+		  gtk_file_system_cancel_operation (impl->should_respond_get_info_handle);
+		  g_object_unref (impl->should_respond_get_info_handle);
+		}
 
 	      impl->should_respond_get_info_handle =
 	        gtk_file_system_get_info (impl->file_system, parent_path,
@@ -7832,6 +7853,7 @@ shortcuts_activate_volume_mount_cb (GtkF
     goto out;
 
   impl->shortcuts_activate_iter_handle = NULL;
+  g_object_unref (handle);
 
   set_busy_cursor (impl, FALSE);
 
@@ -7858,8 +7880,7 @@ shortcuts_activate_volume_mount_cb (GtkF
     }
 
 out:
-  g_object_unref (impl);
-  g_object_unref (handle);
+  g_object_unref (impl);
 }
 
 
@@ -7919,6 +7941,7 @@ shortcuts_activate_get_info_cb (GtkFileS
     goto out;
 
   data->impl->shortcuts_activate_iter_handle = NULL;
+  g_object_unref (handle);
 
   if (cancelled)
     goto out;
@@ -7929,11 +7952,9 @@ shortcuts_activate_get_info_cb (GtkFileS
     gtk_file_chooser_default_select_path (GTK_FILE_CHOOSER (data->impl), data->path, NULL);
 
 out:
-  g_object_unref (data->impl);
+  g_object_unref (data->impl);
   gtk_file_path_free (data->path);
   g_free (data);
-
-  g_object_unref (handle);
 }
 
 static void
@@ -7957,6 +7978,7 @@ shortcuts_activate_iter (GtkFileChooserD
   if (impl->shortcuts_activate_iter_handle)
     {
       gtk_file_system_cancel_operation (impl->shortcuts_activate_iter_handle);
+      g_object_unref (impl->shortcuts_activate_iter_handle);
       impl->shortcuts_activate_iter_handle = NULL;
     }
 
Index: gtk/gtkfilesystem.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkfilesystem.c,v
retrieving revision 1.58
diff -u -p -r1.58 gtkfilesystem.c
--- gtk/gtkfilesystem.c	22 May 2006 12:53:13 -0000	1.58
+++ gtk/gtkfilesystem.c	19 Jul 2006 22:41:52 -0000
@@ -71,7 +71,7 @@ gtk_file_info_new  (void)
 {
   GtkFileInfo *info;
   
-  info = g_new0 (GtkFileInfo, 1);
+  info = g_slice_new0 (GtkFileInfo);
 
   return info;
 }
@@ -83,7 +83,9 @@ gtk_file_info_copy (GtkFileInfo *info)
 
   g_return_val_if_fail (info != NULL, NULL);
 
-  new_info = g_memdup (info, sizeof (GtkFileInfo));
+  new_info = g_slice_new (GtkFileInfo);
+  *new_info = *info;
+
   if (new_info->display_name)
     new_info->display_name = g_strdup (new_info->display_name);
   if (new_info->display_key)
@@ -103,16 +105,12 @@ gtk_file_info_free (GtkFileInfo *info)
 {
   g_return_if_fail (info != NULL);
 
-  if (info->display_name)
-    g_free (info->display_name);
-  if (info->mime_type)
-    g_free (info->mime_type);
-  if (info->display_key)
-    g_free (info->display_key);
-  if (info->icon_name)
-    g_free (info->icon_name);
+  g_free (info->display_name);
+  g_free (info->mime_type);
+  g_free (info->display_key);
+  g_free (info->icon_name);
 
-  g_free (info);
+  g_slice_free (GtkFileInfo, info);
 }
 
 G_CONST_RETURN gchar *
@@ -158,8 +156,7 @@ gtk_file_info_set_display_name (GtkFileI
   if (display_name == info->display_name)
     return;
 
-  if (info->display_name)
-    g_free (info->display_name);
+  g_free (info->display_name);
   if (info->display_key)
     {
       g_free (info->display_key);
@@ -217,8 +214,7 @@ gtk_file_info_set_mime_type (GtkFileInfo
 {
   g_return_if_fail (info != NULL);
   
-  if (info->mime_type)
-    g_free (info->mime_type);
+  g_free (info->mime_type);
 
   info->mime_type = g_strdup (mime_type);
 }
@@ -264,8 +260,7 @@ gtk_file_info_set_icon_name (GtkFileInfo
 {
   g_return_if_fail (info != NULL);
   
-  if (info->icon_name)
-    g_free (info->icon_name);
+  g_free (info->icon_name);
 
   info->icon_name = g_strdup (icon_name);
 }
@@ -341,6 +336,16 @@ gtk_file_system_handle_init (GtkFileSyst
 }
 
 static void
+gtk_file_system_handle_finalize (GObject      *object)
+{
+  GtkFileSystemHandle *handle = GTK_FILE_SYSTEM_HANDLE (object);
+
+  g_object_unref (handle->file_system);
+
+  G_OBJECT_CLASS (gtk_file_system_handle_parent_class)->finalize (object);
+}
+
+static void
 gtk_file_system_handle_set_property (GObject      *object,
 				     guint         prop_id,
 				     const GValue *value,
@@ -377,6 +382,7 @@ gtk_file_system_handle_class_init (GtkFi
   o_class = (GObjectClass *)klass;
   o_class->set_property = gtk_file_system_handle_set_property;
   o_class->get_property = gtk_file_system_handle_get_property;
+  o_class->finalize     = gtk_file_system_handle_finalize;
 
   g_object_class_install_property (o_class,
 				   PROP_CANCELLED,
Index: gtk/gtkfilesystemunix.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkfilesystemunix.c,v
retrieving revision 1.77
diff -u -p -r1.77 gtkfilesystemunix.c
--- gtk/gtkfilesystemunix.c	6 Jul 2006 05:14:01 -0000	1.77
+++ gtk/gtkfilesystemunix.c	19 Jul 2006 22:41:56 -0000
@@ -420,9 +420,9 @@ dispatch_get_info_callback (struct get_i
   if (info->error)
     g_error_free (info->error);
 
-  g_object_unref (info->handle);
+  g_object_unref (info->handle);
 
-  g_free (info);
+  g_slice_free (struct get_info_callback, info);
 }
 
 static inline void
@@ -434,9 +434,9 @@ queue_get_info_callback (GtkFileSystemGe
 {
   struct get_info_callback *info;
 
-  info = g_new (struct get_info_callback, 1);
+  info = g_slice_new (struct get_info_callback);
   info->callback = callback;
-  info->handle = handle;
+  info->handle = g_object_ref (handle);
   info->file_info = file_info;
   info->error = error;
   info->data = data;
@@ -462,9 +462,9 @@ dispatch_get_folder_callback (struct get
   if (info->error)
     g_error_free (info->error);
 
-  g_object_unref (info->handle);
+  g_object_unref (info->handle);
 
-  g_free (info);
+  g_slice_free (struct get_folder_callback, info);
 }
 
 static inline void
@@ -476,9 +476,9 @@ queue_get_folder_callback (GtkFileSystem
 {
   struct get_folder_callback *info;
 
-  info = g_new (struct get_folder_callback, 1);
+  info = g_slice_new (struct get_folder_callback);
   info->callback = callback;
-  info->handle = handle;
+  info->handle = g_object_ref (handle);
   info->folder = folder;
   info->error = error;
   info->data = data;
@@ -507,9 +507,9 @@ dispatch_create_folder_callback (struct 
   if (info->path)
     gtk_file_path_free (info->path);
 
-  g_object_unref (info->handle);
+  g_object_unref (info->handle);
 
-  g_free (info);
+  g_slice_free (struct create_folder_callback, info);
 }
 
 static inline void
@@ -521,9 +521,9 @@ queue_create_folder_callback (GtkFileSys
 {
   struct create_folder_callback *info;
 
-  info = g_new (struct create_folder_callback, 1);
+  info = g_slice_new (struct create_folder_callback);
   info->callback = callback;
-  info->handle = handle;
+  info->handle = g_object_ref (handle);
   info->path = gtk_file_path_copy (path);
   info->error = error;
   info->data = data;
@@ -549,9 +549,9 @@ dispatch_volume_mount_callback (struct v
   if (info->error)
     g_error_free (info->error);
 
-  g_object_unref (info->handle);
+  g_object_unref (info->handle);
 
-  g_free (info);
+  g_slice_free (struct volume_mount_callback, info);
 }
 
 static inline void
@@ -563,9 +563,9 @@ queue_volume_mount_callback (GtkFileSyst
 {
   struct volume_mount_callback *info;
 
-  info = g_new (struct volume_mount_callback, 1);
+  info = g_slice_new (struct volume_mount_callback);
   info->callback = callback;
-  info->handle = handle;
+  info->handle = g_object_ref (handle);
   info->volume = volume;
   info->error = error;
   info->data = data;
@@ -621,7 +621,7 @@ execute_callbacks_idle (gpointer data)
 	    break;
         }
 
-      g_free (info);
+      g_slice_free (struct callback_info, info);
     }
 
   g_slist_free (callbacks);
@@ -639,7 +639,7 @@ queue_callback (enum callback_types type
 {
   struct callback_info *info;
 
-  info = g_new (struct callback_info, 1);
+  info = g_slice_new (struct callback_info);
   info->type = type;
 
   switch (type)
@@ -664,7 +664,8 @@ queue_callback (enum callback_types type
   callbacks = g_slist_append (callbacks, info);
 
   if (!execute_callbacks_idle_id)
-    execute_callbacks_idle_id = g_idle_add (execute_callbacks_idle, NULL);
+    execute_callbacks_idle_id = g_idle_add_full (G_PRIORITY_DEFAULT_IDLE,
+	execute_callbacks_idle, NULL, (GDestroyNotify)execute_callbacks_idle);
 }
 
 static GtkFileSystemHandle *
@@ -673,7 +674,7 @@ create_handle (GtkFileSystem *file_syste
   GtkFileSystemHandle *handle;
 
   handle = g_object_new (GTK_TYPE_FILE_SYSTEM_HANDLE, NULL);
-  handle->file_system = file_system;
+  handle->file_system = g_object_ref (file_system);
 
   return handle;
 }
@@ -705,7 +706,6 @@ gtk_file_system_unix_get_info (GtkFileSy
 
   if (!stat_with_error (filename, &statbuf, &error))
     {
-      g_object_ref (handle);
       queue_get_info_callback (callback, handle, NULL, error, data);
       return handle;
     }
@@ -720,7 +720,6 @@ gtk_file_system_unix_get_info (GtkFileSy
   info = create_file_info (NULL, filename, basename, types, &statbuf,
                            mime_type);
   g_free (basename);
-  g_object_ref (handle);
   queue_get_info_callback (callback, handle, info, NULL, data);
 
   return handle;
@@ -843,7 +842,6 @@ gtk_file_system_unix_get_folder (GtkFile
 		       display_name,
 		       g_strerror (my_errno));
 
-	  g_object_ref (handle);
 	  queue_get_folder_callback (callback, handle, NULL, error, data);
 
 	  g_free (display_name);
@@ -881,7 +879,6 @@ gtk_file_system_unix_get_folder (GtkFile
   if (set_asof)
     folder_unix->asof = time (NULL);
 
-  g_object_ref (handle);
   queue_get_folder_callback (callback, handle, GTK_FILE_FOLDER (folder_unix), NULL, data);
 
   /* Start loading the folder contents in an idle */
@@ -929,14 +926,12 @@ gtk_file_system_unix_create_folder (GtkF
 		   display_name,
 		   g_strerror (save_errno));
       
-      g_object_ref (handle);
       queue_create_folder_callback (callback, handle, path, error, data);
 
       g_free (display_name);
       return handle;
     }
 
-  g_object_ref (handle);
   queue_create_folder_callback (callback, handle, path, NULL, data);
 
   parent = get_parent_dir (filename);
@@ -952,7 +947,7 @@ gtk_file_system_unix_create_folder (GtkF
 	  struct stat_info_entry *entry;
 
 	  /* Make sure the new folder exists in the parent's folder */
-	  entry = g_new0 (struct stat_info_entry, 1);
+	  entry = g_slice_new0 (struct stat_info_entry);
 	  if (folder_unix->is_network_dir)
 	    {
 	      entry->statbuf.st_mode = S_IFDIR;
@@ -1033,7 +1028,6 @@ gtk_file_system_unix_volume_mount (GtkFi
 	       GTK_FILE_SYSTEM_ERROR_FAILED,
 	       _("This file system does not support mounting"));
 
-  g_object_ref (handle);
   queue_volume_mount_callback (callback, handle, volume, error, data);
 
   return handle;
@@ -2218,7 +2212,7 @@ create_stat_info_entry_and_emit_add (Gtk
   GtkFilePath *path;
   struct stat_info_entry *entry;
 
-  entry = g_new0 (struct stat_info_entry, 1);
+  entry = g_slice_new0 (struct stat_info_entry);
 
   if ((folder_unix->types & STAT_NEEDED_MASK) != 0)
     entry->statbuf = *statbuf;
@@ -2357,7 +2351,7 @@ static void
 free_stat_info_entry (struct stat_info_entry *entry)
 {
   g_free (entry->mime_type);
-  g_free (entry);
+  g_slice_free (struct stat_info_entry, entry);
 }
 
 static gboolean
@@ -2385,7 +2379,7 @@ fill_in_names (GtkFileFolderUnix *folder
       if (!basename)
 	break;
 
-      entry = g_new0 (struct stat_info_entry, 1);
+      entry = g_slice_new0 (struct stat_info_entry);
       if (folder_unix->is_network_dir)
 	{
 	  entry->statbuf.st_mode = S_IFDIR;
Index: gtk/gtkfilesystemwin32.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkfilesystemwin32.c,v
retrieving revision 1.37
diff -u -p -r1.37 gtkfilesystemwin32.c
--- gtk/gtkfilesystemwin32.c	21 May 2006 23:48:49 -0000	1.37
+++ gtk/gtkfilesystemwin32.c	19 Jul 2006 22:41:58 -0000
@@ -760,7 +760,7 @@ create_handle (GtkFileSystem *file_syste
   GtkFileSystemHandle *handle;
 
   handle = g_object_new (GTK_TYPE_FILE_SYSTEM_HANDLE, NULL);
-  handle->file_system = file_system;
+  handle->file_system = g_object_ref (file_system);
 
   return handle;
 }

