diff -Nru gvfs-1.24.2/debian/changelog gvfs-1.24.2/debian/changelog --- gvfs-1.24.2/debian/changelog 2015-10-09 13:22:54.000000000 +0000 +++ gvfs-1.24.2/debian/changelog 2015-10-16 09:32:23.000000000 +0000 @@ -1,3 +1,11 @@ +gvfs (1.24.2-0ubuntu4) wily; urgency=medium + + * Restore previous change and include extra fix needed on top of it, + with the current glib it should make trash restore work, + debian/patches/git_invalid_read.patch (lp: #1495943) + + -- Sebastien Bacher Fri, 16 Oct 2015 10:29:31 +0100 + gvfs (1.24.2-0ubuntu3) wily; urgency=medium * debian/patches/git_construct_sync.patch: diff -Nru gvfs-1.24.2/debian/patches/git_construct_sync.patch gvfs-1.24.2/debian/patches/git_construct_sync.patch --- gvfs-1.24.2/debian/patches/git_construct_sync.patch 1970-01-01 00:00:00.000000000 +0000 +++ gvfs-1.24.2/debian/patches/git_construct_sync.patch 2015-10-16 09:29:28.000000000 +0000 @@ -0,0 +1,214 @@ +From 7373acf9b15f40f1c01bd2a325b380ba9bc17d19 Mon Sep 17 00:00:00 2001 +From: Alexander Larsson +Date: Wed, 30 Sep 2015 10:39:57 +0200 +Subject: file monitor: Construct synchronously + +g_file_monitor_file() is a sync call anyway, so doing some sync i/o +in the constructor doesn't make a difference, and doing so avoids +races where you would not get change events for operations you do. + +We don't actually need to wait for the subscribe event, and proxy +construction in this case does not do any i/o, so we're really only +doing sync i/o to look up the connection, and it should be cached from +the earlier call in g_daemon_file_monitor_file(), so in practice +this should make little difference. + +https://bugzilla.gnome.org/show_bug.cgi?id=749317 +--- + client/gdaemonfilemonitor.c | 141 ++++++++++++++++++-------------------------- + 1 file changed, 58 insertions(+), 83 deletions(-) + +diff --git a/client/gdaemonfilemonitor.c b/client/gdaemonfilemonitor.c +index 4de3b24..313b06f 100644 +--- a/client/gdaemonfilemonitor.c ++++ b/client/gdaemonfilemonitor.c +@@ -47,7 +47,7 @@ struct _GDaemonFileMonitor + char *remote_obj_path; + char *remote_id; + GDBusConnection *connection; +- GVfsDBusMonitor *proxy; ++ GVfsDBusMonitor *proxy; /* Non-null if we're subscribed */ + GVfsDBusMonitorClient *skeleton; + }; + +@@ -57,7 +57,7 @@ static void + g_daemon_file_monitor_finalize (GObject* object) + { + GDaemonFileMonitor *daemon_monitor; +- ++ + daemon_monitor = G_DAEMON_FILE_MONITOR (object); + + if (daemon_monitor->skeleton) +@@ -107,7 +107,7 @@ handle_changed (GVfsDBusMonitorClient *object, + g_mount_spec_unref (spec1); + + file2 = NULL; +- ++ + if (strlen (arg_other_file_path) > 0) + { + spec2 = g_mount_spec_from_dbus (arg_other_mount_spec); +@@ -118,9 +118,9 @@ handle_changed (GVfsDBusMonitorClient *object, + g_file_monitor_emit_event (G_FILE_MONITOR (monitor), + file1, file2, + arg_event_type); +- ++ + gvfs_dbus_monitor_client_complete_changed (object, invocation); +- ++ + return TRUE; + } + +@@ -167,94 +167,69 @@ subscribe_cb (GVfsDBusMonitor *proxy, + g_object_unref (monitor); + } + +-static void +-async_proxy_new_cb (GObject *source_object, +- GAsyncResult *res, +- gpointer user_data) +-{ +- GDaemonFileMonitor* monitor = user_data; +- GVfsDBusMonitor *proxy; +- GError *error = NULL; +- +- proxy = gvfs_dbus_monitor_proxy_new_finish (res, &error); +- if (proxy == NULL) +- { +- g_printerr ("Error creating monitor proxy: %s (%s, %d)\n", +- error->message, g_quark_to_string (error->domain), error->code); +- g_error_free (error); +- g_clear_object (&monitor->connection); +- g_object_unref (monitor); +- return; +- } +- +- if (g_file_monitor_is_cancelled (G_FILE_MONITOR (monitor))) +- { +- g_clear_object (&monitor->connection); +- g_object_unref (proxy); +- g_object_unref (monitor); +- return; +- } +- +- gvfs_dbus_monitor_call_subscribe (proxy, +- monitor->object_path, +- NULL, +- (GAsyncReadyCallback) subscribe_cb, +- monitor); +- g_object_unref (proxy); +-} +- +-static void +-async_got_connection_cb (GDBusConnection *connection, +- GError *io_error, +- gpointer callback_data) +-{ +- GDaemonFileMonitor* monitor = callback_data; +- GError *error; +- +- if (! connection) +- { +- g_printerr ("Error getting connection for monitoring: %s (%s, %d)\n", +- io_error->message, g_quark_to_string (io_error->domain), io_error->code); +- g_object_unref (monitor); +- return; +- } +- +- error = NULL; +- if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (monitor->skeleton), +- connection, +- monitor->object_path, +- &error)) +- { +- g_warning ("Error registering path: %s (%s, %d)\n", +- error->message, g_quark_to_string (error->domain), error->code); +- g_error_free (error); +- } +- +- monitor->connection = g_object_ref (connection); +- gvfs_dbus_monitor_proxy_new (connection, +- G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS, +- monitor->remote_id, +- monitor->remote_obj_path, +- NULL, +- async_proxy_new_cb, +- monitor); +-} +- + GFileMonitor* + g_daemon_file_monitor_new (const char *remote_id, +- const char *remote_obj_path) ++ const char *remote_obj_path) + { + GDaemonFileMonitor* daemon_monitor; ++ GDBusConnection *connection; ++ GError *error = NULL; ++ GVfsDBusMonitor *proxy; + + daemon_monitor = g_object_new (G_TYPE_DAEMON_FILE_MONITOR, NULL); + + daemon_monitor->remote_id = g_strdup (remote_id); + daemon_monitor->remote_obj_path = g_strdup (remote_obj_path); + +- _g_dbus_connection_get_for_async (daemon_monitor->remote_id, +- async_got_connection_cb, +- g_object_ref (daemon_monitor), +- NULL); ++ daemon_monitor->connection = _g_dbus_connection_get_sync (daemon_monitor->remote_id, NULL, &error); ++ if (daemon_monitor->connection == NULL) ++ { ++ g_printerr ("Error getting connection for monitoring: %s (%s, %d)\n", ++ error->message, g_quark_to_string (error->domain), error->code); ++ g_error_free (error); ++ } ++ else ++ { ++ if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (daemon_monitor->skeleton), ++ daemon_monitor->connection, ++ daemon_monitor->object_path, ++ &error)) ++ { ++ g_warning ("Error registering path: %s (%s, %d)\n", ++ error->message, g_quark_to_string (error->domain), error->code); ++ g_error_free (error); ++ } ++ ++ /* This looks like a sync call, but since the remote_id is a ++ unique id we don't actually send any messages */ ++ proxy = gvfs_dbus_monitor_proxy_new_sync (daemon_monitor->connection, ++ G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS, ++ daemon_monitor->remote_id, ++ daemon_monitor->remote_obj_path, ++ NULL, ++ &error); ++ if (proxy == NULL) ++ { ++ g_printerr ("Error creating monitor proxy: %s (%s, %d)\n", ++ error->message, g_quark_to_string (error->domain), error->code); ++ g_error_free (error); ++ } ++ else ++ { ++ /* We set the proxy in the callback, meaning we're subscribed if it is set */ ++ gvfs_dbus_monitor_call_subscribe (proxy, ++ daemon_monitor->object_path, ++ NULL, ++ (GAsyncReadyCallback) subscribe_cb, ++ g_object_ref (daemon_monitor)); ++ g_object_unref (proxy); ++ ++ /* At this point it is safe to return the monitor, even if we have not gotten ++ the reply to the subscribe yet, because any i/o we do to the mount such ++ as listing a directory will happen after the mount receives the subscribe ++ message */ ++ } ++ } + + return G_FILE_MONITOR (daemon_monitor); + } +-- +cgit v0.11.2 + diff -Nru gvfs-1.24.2/debian/patches/git_invalid_read.patch gvfs-1.24.2/debian/patches/git_invalid_read.patch --- gvfs-1.24.2/debian/patches/git_invalid_read.patch 1970-01-01 00:00:00.000000000 +0000 +++ gvfs-1.24.2/debian/patches/git_invalid_read.patch 2015-10-16 09:30:43.000000000 +0000 @@ -0,0 +1,82 @@ +From 44d48ebfc3f322dc73d6a0b7b2bf92bdb3e905ee Mon Sep 17 00:00:00 2001 +From: Ondrej Holy +Date: Tue, 13 Oct 2015 12:37:10 +0200 +Subject: file monitor: Fix invalid read + +Commit 7373acf changed file monitor construction to be really +synchronous. Unfortunately there is missing g_object_ref for d-bus +connection and the connection is unrefed after use. Subsequent read +of the unrefed connection cause crash with following critical: + +(firefox:29844): GLib-GIO-CRITICAL **: g_dbus_connection_is_closed: +assertion 'G_IS_DBUS_CONNECTION (connection)' failed + +Do not store the connection, because it isn't neccesary with the +synchronous construction. + +https://bugzilla.gnome.org/show_bug.cgi?id=756153 +--- + client/gdaemonfilemonitor.c | 12 ++++-------- + 1 file changed, 4 insertions(+), 8 deletions(-) + +diff --git a/client/gdaemonfilemonitor.c b/client/gdaemonfilemonitor.c +index 313b06f..2d9f958 100644 +--- a/client/gdaemonfilemonitor.c ++++ b/client/gdaemonfilemonitor.c +@@ -46,7 +46,6 @@ struct _GDaemonFileMonitor + char *object_path; + char *remote_obj_path; + char *remote_id; +- GDBusConnection *connection; + GVfsDBusMonitor *proxy; /* Non-null if we're subscribed */ + GVfsDBusMonitorClient *skeleton; + }; +@@ -68,8 +67,6 @@ g_daemon_file_monitor_finalize (GObject* object) + + g_clear_object (&daemon_monitor->proxy); + +- g_clear_object (&daemon_monitor->connection); +- + g_free (daemon_monitor->object_path); + g_free (daemon_monitor->remote_id); + g_free (daemon_monitor->remote_obj_path); +@@ -157,7 +154,6 @@ subscribe_cb (GVfsDBusMonitor *proxy, + gvfs_dbus_monitor_call_unsubscribe (proxy, + monitor->object_path, + NULL, NULL, NULL); +- g_clear_object (&monitor->connection); + g_object_unref (monitor); + return; + } +@@ -181,8 +177,8 @@ g_daemon_file_monitor_new (const char *remote_id, + daemon_monitor->remote_id = g_strdup (remote_id); + daemon_monitor->remote_obj_path = g_strdup (remote_obj_path); + +- daemon_monitor->connection = _g_dbus_connection_get_sync (daemon_monitor->remote_id, NULL, &error); +- if (daemon_monitor->connection == NULL) ++ connection = _g_dbus_connection_get_sync (daemon_monitor->remote_id, NULL, &error); ++ if (connection == NULL) + { + g_printerr ("Error getting connection for monitoring: %s (%s, %d)\n", + error->message, g_quark_to_string (error->domain), error->code); +@@ -191,7 +187,7 @@ g_daemon_file_monitor_new (const char *remote_id, + else + { + if (!g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (daemon_monitor->skeleton), +- daemon_monitor->connection, ++ connection, + daemon_monitor->object_path, + &error)) + { +@@ -202,7 +198,7 @@ g_daemon_file_monitor_new (const char *remote_id, + + /* This looks like a sync call, but since the remote_id is a + unique id we don't actually send any messages */ +- proxy = gvfs_dbus_monitor_proxy_new_sync (daemon_monitor->connection, ++ proxy = gvfs_dbus_monitor_proxy_new_sync (connection, + G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES | G_DBUS_PROXY_FLAGS_DO_NOT_CONNECT_SIGNALS, + daemon_monitor->remote_id, + daemon_monitor->remote_obj_path, +-- +cgit v0.11.2 + diff -Nru gvfs-1.24.2/debian/patches/series gvfs-1.24.2/debian/patches/series --- gvfs-1.24.2/debian/patches/series 2015-10-09 13:17:07.000000000 +0000 +++ gvfs-1.24.2/debian/patches/series 2015-10-16 09:31:12.000000000 +0000 @@ -7,4 +7,5 @@ dont-crash-on-null-job.patch handle-inactive-vfs.patch ref-jobs-in-thread.patch - +git_construct_sync.patch +git_invalid_read.patch