summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
authorOndrej Holy <oholy@redhat.com>2015-10-13 12:37:10 +0200
committerOndrej Holy <oholy@redhat.com>2015-10-14 16:37:32 +0200
commit44d48ebfc3f322dc73d6a0b7b2bf92bdb3e905ee (patch)
tree48c3b316657aed5c5ccded57b0cb36377e7ed85a /client
parentfe5f4c13150d127cf445e3b5a84d40a6e5c8bcd0 (diff)
downloadgvfs-44d48ebfc3f322dc73d6a0b7b2bf92bdb3e905ee.tar.gz
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
Diffstat (limited to 'client')
-rw-r--r--client/gdaemonfilemonitor.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/client/gdaemonfilemonitor.c b/client/gdaemonfilemonitor.c
index 313b06ff..2d9f958f 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,