[nautilus] gtkplacesview: match master to fix crashes
- From: Carlos Soriano Sánchez <csoriano src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus] gtkplacesview: match master to fix crashes
- Date: Fri, 21 Aug 2015 18:01:06 +0000 (UTC)
commit 18b9ca4a477c991ca4f9568bc73429a5dce50b41
Author: Carlos Soriano <csoriano gnome org>
Date: Fri Aug 21 19:59:19 2015 +0200
gtkplacesview: match master to fix crashes
Just match gtkplacesview from master which has some fixes
for cancellables operations accesing the private struct when
cancelled, and therefore making it crash.
https://bugzilla.gnome.org/show_bug.cgi?id=753939
src/gtk/gtkplacesview.c | 56 ++++++++++++++++++++++++++++------------------
1 files changed, 34 insertions(+), 22 deletions(-)
---
diff --git a/src/gtk/gtkplacesview.c b/src/gtk/gtkplacesview.c
index 87b886b..a6344c3 100644
--- a/src/gtk/gtkplacesview.c
+++ b/src/gtk/gtkplacesview.c
@@ -1143,21 +1143,11 @@ server_mount_ready_cb (GObject *source_file,
GError *error;
GFile *location;
- view = GTK_PLACES_VIEW (user_data);
- priv = gtk_places_view_get_instance_private (view);
location = G_FILE (source_file);
should_show = TRUE;
error = NULL;
- priv->should_pulse_entry = FALSE;
- set_busy_cursor (view, FALSE);
-
g_file_mount_enclosing_volume_finish (location, res, &error);
- /* Restore from Cancel to Connect */
- gtk_button_set_label (GTK_BUTTON (priv->connect_button), _("Con_nect"));
- gtk_widget_set_sensitive (priv->address_entry, TRUE);
- priv->connecting_to_server = FALSE;
-
if (error)
{
should_show = FALSE;
@@ -1174,14 +1164,30 @@ server_mount_ready_cb (GObject *source_file,
(error->code != G_IO_ERROR_CANCELLED &&
error->code != G_IO_ERROR_FAILED_HANDLED))
{
+ view = GTK_PLACES_VIEW (user_data);
/* if it wasn't cancelled show a dialog */
emit_show_error_message (view, _("Unable to access location"), error->message);
should_show = FALSE;
}
-
+ else
+ {
+ /* it was cancelled, so probably it was called during finalize, bail out. */
+ g_clear_error (&error);
+ return;
+ }
g_clear_error (&error);
}
+ view = GTK_PLACES_VIEW (user_data);
+ priv = gtk_places_view_get_instance_private (view);
+ priv->should_pulse_entry = FALSE;
+ set_busy_cursor (view, FALSE);
+
+ /* Restore from Cancel to Connect */
+ gtk_button_set_label (GTK_BUTTON (priv->connect_button), _("Con_nect"));
+ gtk_widget_set_sensitive (priv->address_entry, TRUE);
+ priv->connecting_to_server = FALSE;
+
if (should_show)
{
server_list_add_server (view, location);
@@ -1232,14 +1238,10 @@ volume_mount_ready_cb (GObject *source_volume,
GVolume *volume;
GError *error;
- view = GTK_PLACES_VIEW (user_data);
- priv = gtk_places_view_get_instance_private (view);
volume = G_VOLUME (source_volume);
should_show = TRUE;
error = NULL;
- set_busy_cursor (view, FALSE);
-
g_volume_mount_finish (volume, res, &error);
if (error)
@@ -1262,10 +1264,20 @@ volume_mount_ready_cb (GObject *source_volume,
emit_show_error_message (GTK_PLACES_VIEW (user_data), _("Unable to access location"),
error->message);
should_show = FALSE;
}
+ else
+ {
+ /* it was cancelled, so probably it was called during finalize, bail out. */
+ g_clear_error (&error);
+ return;
+ }
g_clear_error (&error);
}
+ view = GTK_PLACES_VIEW (user_data);
+ priv = gtk_places_view_get_instance_private (view);
+ set_busy_cursor (view, FALSE);
+
if (should_show)
{
GMount *mount;
@@ -1999,8 +2011,8 @@ listbox_sort_func (GtkListBoxRow *row1,
{
gboolean row1_is_network;
gboolean row2_is_network;
- gchar *location1;
- gchar *location2;
+ gchar *path1;
+ gchar *path2;
gboolean *is_placeholder1;
gboolean *is_placeholder2;
gint retval;
@@ -2024,13 +2036,13 @@ listbox_sort_func (GtkListBoxRow *row1,
if (is_placeholder2)
return 1;
- g_object_get (row1, "path", &location1, NULL);
- g_object_get (row2, "path", &location2, NULL);
+ g_object_get (row1, "path", &path1, NULL);
+ g_object_get (row2, "path", &path2, NULL);
- retval = g_strcmp0 (location1, location2);
+ retval = g_utf8_collate (path1, path2);
- g_free (location1);
- g_free (location2);
+ g_free (path1);
+ g_free (path2);
return retval;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]