From 78cf2dd5158049174e61fddff3130542032553d5 Mon Sep 17 00:00:00 2001 From: Tim Lunn Date: Wed, 13 Jan 2016 18:38:55 +1100 Subject: lua-factory: avoid double free of GOA data This fixes test suite failure under Ubuntu buildd's where there is not running X session, so goa_client_new_finish() fails with an error. https://bugzilla.gnome.org/show_bug.cgi?id=760565 --- src/lua-factory/grl-lua-factory.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/lua-factory/grl-lua-factory.c b/src/lua-factory/grl-lua-factory.c index 0ee136b..5b531da 100644 --- a/src/lua-factory/grl-lua-factory.c +++ b/src/lua-factory/grl-lua-factory.c @@ -185,9 +185,6 @@ grl_lua_factory_plugin_init (GrlRegistry *registry, GError *err = NULL; gboolean source_loaded = FALSE; GCancellable *cancellable; -#ifdef GOA_ENABLED - GList *lua_init_sources = NULL; -#endif GRL_LOG_DOMAIN_INIT (lua_factory_log_domain, "lua-factory"); @@ -220,11 +217,9 @@ grl_lua_factory_plugin_init (GrlRegistry *registry, goa_client_new (cancellable, grl_lua_factory_goa_init, goa_data); - lua_init_sources = g_list_prepend (lua_init_sources, goa_data); } g_list_free (goa_sources); - g_object_set_data (G_OBJECT (plugin), "lua-init-sources", lua_init_sources); #else g_assert (goa_sources == NULL); #endif @@ -782,6 +777,7 @@ grl_lua_goa_data_free (GrlLuaGoaData *data) g_free (data->account_provider); g_free (data->account_feature); g_clear_pointer (&data->sources, g_hash_table_destroy); + g_free (data); } static void @@ -793,6 +789,7 @@ grl_lua_factory_goa_init (GObject *source_object, GList *tmp; GList *acc_list; GList *lua_acc_list = NULL; + GList *lua_init_sources = NULL; GrlLuaGoaData *lua_data = user_data; GoaClient *client; @@ -806,6 +803,10 @@ grl_lua_factory_goa_init (GObject *source_object, return; } + lua_init_sources = g_object_get_data (G_OBJECT (lua_data->plugin), "lua-init-sources"); + lua_init_sources = g_list_prepend (lua_init_sources, lua_data); + g_object_set_data (G_OBJECT (lua_data->plugin), "lua-init-sources", lua_init_sources); + lua_data->client = client; acc_list = goa_client_get_accounts (client); -- cgit v1.2.3