summaryrefslogtreecommitdiff
path: root/monitor
diff options
context:
space:
mode:
authorMatthew Leeds <matthew.leeds@endlessm.com>2019-07-12 14:32:48 -0700
committerMatthew Leeds <matthew.leeds@endlessm.com>2019-07-15 12:42:22 -0700
commit12b238a38739d1bf01f021e448c6a1f5623f7e9b (patch)
tree2880e280a6661eb4951537943e21321a66277ed4 /monitor
parent3236c26ffea3a582393563955d6f9e7593b3ddd6 (diff)
downloadgvfs-12b238a38739d1bf01f021e448c6a1f5623f7e9b.tar.gz
ProxyVolumeMonitor: Don't leak a GVfsDBusDaemon
In g_proxy_volume_monitor_register() we create a GVfsDBusDaemon object (which is also of type GDBusProxy) but never free it. This causes there to be a dangling reference to the singleton GDBusConnection object used by the GDBusProxy for the rest of the lifetime of a process that uses a gvfs function such as g_file_new_for_path(). With the recent changes I made to GLib[1], that extra reference leads to a warning after a 30 second delay in g_test_dbus_down(). So this commit frees the GVfsDBusDaemon object after it has served its purpose in g_proxy_volume_monitor_register(), which fixes the test failure I'm seeing in another project. This is consistent with how we handle GDBusProxy objects in most of the rest of gvfs, but there are two places where they are leaked: 1. in g_proxy_volume_monitor_constructor(), but that object appears to be intended to live forever, so it's unclear what should be done there 2. in meta_tree_get_metadata_proxy(), but there the proxy is a static variable so it's unclear when it should be freed If you try to reproduce this leak, note that if gio takes its "lazy loading" code path in g_io_modules_scan_all_in_directory_with_scope(), this g_proxy_volume_monitor_register() function may not be executed. So I had to change an if condition so that we would always call g_type_module_use(). That lazy loading only happened when I built and installed gvfs myself rather than using the distribution's package. [1] https://gitlab.gnome.org/GNOME/glib/merge_requests/963
Diffstat (limited to 'monitor')
-rw-r--r--monitor/proxy/gproxyvolumemonitor.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/monitor/proxy/gproxyvolumemonitor.c b/monitor/proxy/gproxyvolumemonitor.c
index 9b2a973c..3237a3a5 100644
--- a/monitor/proxy/gproxyvolumemonitor.c
+++ b/monitor/proxy/gproxyvolumemonitor.c
@@ -1497,6 +1497,8 @@ g_proxy_volume_monitor_register (GIOModule *module)
g_debug ("Error: %s\n", error->message);
g_error_free (error);
}
+
+ g_clear_object (&proxy);
}
else
{