summaryrefslogtreecommitdiff
path: root/gdbus
diff options
context:
space:
mode:
authorAndre Moreira Magalhaes <andre@endlessm.com>2019-07-23 17:17:50 +0000
committerAndre Moreira Magalhaes <andre@endlessm.com>2019-07-24 21:37:22 +0000
commit6fbf07188542806f126bbee4f15bd0eb95057843 (patch)
tree739da493a03406af3a8e99afdb9231bd06bef90b /gdbus
parentf992a5c2a61d2beadb0e84dd42f3e917c0567981 (diff)
downloaddconf-6fbf07188542806f126bbee4f15bd0eb95057843.tar.gz
gdbus/thread: Always copy GError on getters
This change should guarantee that the object is valid while in use. The change is part of a series of changes to fix an issue introduced with recent changes made to GLib[1] where invoking g_test_dbus_down() will fail after a timeout if the GDBusConnection object for the session bus leaks. [1] https://gitlab.gnome.org/GNOME/glib/merge_requests/963 Signed-off-by: Andre Moreira Magalhaes <andre@endlessm.com>
Diffstat (limited to 'gdbus')
-rw-r--r--gdbus/dconf-gdbus-thread.c22
1 files changed, 9 insertions, 13 deletions
diff --git a/gdbus/dconf-gdbus-thread.c b/gdbus/dconf-gdbus-thread.c
index 34c875b..a8985cd 100644
--- a/gdbus/dconf-gdbus-thread.c
+++ b/gdbus/dconf-gdbus-thread.c
@@ -176,13 +176,13 @@ static gpointer dconf_gdbus_get_bus_data[5];
static gboolean dconf_gdbus_get_bus_is_error[5];
static GDBusConnection *
-dconf_gdbus_get_bus_common (GBusType bus_type,
- const GError **error)
+dconf_gdbus_get_bus_common (GBusType bus_type,
+ GError **error)
{
if (dconf_gdbus_get_bus_is_error[bus_type])
{
if (error)
- *error = dconf_gdbus_get_bus_data[bus_type];
+ *error = g_error_copy (dconf_gdbus_get_bus_data[bus_type]);
return NULL;
}
@@ -191,8 +191,8 @@ dconf_gdbus_get_bus_common (GBusType bus_type,
}
static GDBusConnection *
-dconf_gdbus_get_bus_in_worker (GBusType bus_type,
- const GError **error)
+dconf_gdbus_get_bus_in_worker (GBusType bus_type,
+ GError **error)
{
g_assert_cmpint (bus_type, <, G_N_ELEMENTS (dconf_gdbus_get_bus_data));
@@ -261,7 +261,7 @@ dconf_gdbus_method_call (gpointer user_data)
{
DConfGDBusCall *call = user_data;
g_autoptr(GDBusConnection) connection = NULL;
- const GError *error = NULL;
+ g_autoptr(GError) error = NULL;
connection = dconf_gdbus_get_bus_in_worker (call->bus_type, &error);
@@ -323,8 +323,8 @@ dconf_gdbus_summon_bus (gpointer user_data)
}
static GDBusConnection *
-dconf_gdbus_get_bus_for_sync (GBusType bus_type,
- const GError **error)
+dconf_gdbus_get_bus_for_sync (GBusType bus_type,
+ GError **error)
{
g_assert_cmpint (bus_type, <, G_N_ELEMENTS (dconf_gdbus_get_bus_data));
@@ -359,18 +359,14 @@ dconf_engine_dbus_call_sync_func (GBusType bus_type,
const GVariantType *reply_type,
GError **error)
{
- const GError *inner_error = NULL;
g_autoptr(GDBusConnection) connection = NULL;
- connection = dconf_gdbus_get_bus_for_sync (bus_type, &inner_error);
+ connection = dconf_gdbus_get_bus_for_sync (bus_type, error);
if (connection == NULL)
{
g_variant_unref (g_variant_ref_sink (parameters));
- if (error)
- *error = g_error_copy (inner_error);
-
return NULL;
}