gtk2/filesystemref.patch

135 lines
3.7 KiB
Diff

diff -u -r pristine/gtk/gtkfilechooserbutton.c gtk+-2.18.3/gtk/gtkfilechooserbutton.c
--- pristine/gtk/gtkfilechooserbutton.c 2009-10-09 01:00:43.000000000 -0400
+++ gtk+-2.18.3/gtk/gtkfilechooserbutton.c 2009-11-10 19:25:55.257874597 -0500
@@ -1776,10 +1776,16 @@
GFile *base_file;
base_file = _gtk_file_system_volume_get_root (volume);
- if (base_file != NULL && !g_file_is_native (base_file))
+ if (base_file != NULL)
{
- _gtk_file_system_volume_free (volume);
- continue;
+ if (!g_file_is_native (base_file))
+ {
+ g_object_unref (base_file);
+ _gtk_file_system_volume_free (volume);
+ continue;
+ }
+ else
+ g_object_unref (base_file);
}
}
}
diff -u -r pristine/gtk/gtkfilechooserdefault.c gtk+-2.18.3/gtk/gtkfilechooserdefault.c
--- pristine/gtk/gtkfilechooserdefault.c 2009-10-16 10:35:45.000000000 -0400
+++ gtk+-2.18.3/gtk/gtkfilechooserdefault.c 2009-11-10 19:25:49.165873229 -0500
@@ -828,7 +828,7 @@
if (cancellable)
g_cancellable_cancel (cancellable);
- if (!(shortcut_type == SHORTCUT_TYPE_FILE ||
+ if (!(shortcut_type == SHORTCUT_TYPE_FILE ||
shortcut_type == SHORTCUT_TYPE_VOLUME) ||
!col_data)
return;
@@ -840,12 +840,10 @@
volume = col_data;
_gtk_file_system_volume_free (volume);
}
- else
+ if (shortcut_type == SHORTCUT_TYPE_FILE)
{
GFile *file;
- g_assert (shortcut_type == SHORTCUT_TYPE_FILE);
-
file = col_data;
g_object_unref (file);
}
@@ -2094,7 +2092,10 @@
}
if (!base_is_native)
- continue;
+ {
+ _gtk_file_system_volume_free (volume);
+ continue;
+ }
}
}
@@ -3587,9 +3588,7 @@
if (shortcut_type == SHORTCUT_TYPE_SEPARATOR)
return FALSE;
else if (shortcut_type == SHORTCUT_TYPE_VOLUME)
- {
- return FALSE;
- }
+ return FALSE;
else if (shortcut_type == SHORTCUT_TYPE_FILE)
{
GFile *file;
@@ -10794,6 +10793,9 @@
"standard::type",
shortcuts_activate_get_info_cb, data);
}
+
+ if (volume)
+ _gtk_file_system_volume_free (volume);
}
else if (shortcut_type == SHORTCUT_TYPE_SEARCH)
{
diff -u -r pristine/gtk/gtkfilesystem.c gtk+-2.18.3/gtk/gtkfilesystem.c
--- pristine/gtk/gtkfilesystem.c 2009-06-04 15:18:04.000000000 -0400
+++ gtk+-2.18.3/gtk/gtkfilesystem.c 2009-11-10 19:20:13.192873941 -0500
@@ -468,6 +468,8 @@
priv->volumes = g_slist_prepend (priv->volumes, g_object_ref (drive));
}
+
+ g_object_unref (drive);
}
g_list_free (drives);
@@ -499,6 +501,8 @@
/* see comment above in why we add an icon for a volume */
priv->volumes = g_slist_prepend (priv->volumes, g_object_ref (volume));
}
+
+ g_object_unref (volume);
}
/* add mounts that has no volume (/etc/mtab mounts, ftp, sftp,...) */
@@ -520,11 +524,13 @@
*/
if (mount_referenced_by_volume_activation_root (volumes, mount))
{
+ g_object_unref (mount);
continue;
}
/* show this mount */
priv->volumes = g_slist_prepend (priv->volumes, g_object_ref (mount));
+ g_object_unref (mount);
}
g_list_free (volumes);
@@ -604,6 +610,7 @@
get_volumes_list (GTK_FILE_SYSTEM (file_system));
list = g_slist_copy (priv->volumes);
+ g_slist_foreach (list, (GFunc)g_object_ref, NULL);
#ifndef G_OS_WIN32
/* Prepend root volume */
@@ -1025,6 +1032,8 @@
if (error)
g_error_free (error);
+
+ _gtk_file_system_volume_free (volume);
}
GCancellable *