[grilo-plugins/0.2.x] lua-factory: avoid double free of GOA data



commit 4471f47e2c3d47c14f1902150d47f4c8706fcddc
Author: Tim Lunn <tim feathertop org>
Date:   Wed Jan 13 18:38:55 2016 +1100

    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 files changed, 6 insertions(+), 5 deletions(-)
---
diff --git a/src/lua-factory/grl-lua-factory.c b/src/lua-factory/grl-lua-factory.c
index 1742fdf..2914322 100644
--- a/src/lua-factory/grl-lua-factory.c
+++ b/src/lua-factory/grl-lua-factory.c
@@ -186,9 +186,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");
 
@@ -221,11 +218,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
@@ -772,6 +767,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
@@ -783,6 +779,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;
 
@@ -796,6 +793,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);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]