[grilo-plugins] lua-factory: Fix crasher on startup



commit b7b59ffae541d0f81650dca39b734743e19004de
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Feb 24 21:14:55 2014 +0100

    lua-factory: Fix crasher on startup
    
    When the front-end deletes the source during registration, we
    need to make sure that we don't consider the source to be
    registered successfully.
    
    See also commit 5973947051d6ca789965c92c5c33cf66cadd3f25
    which did this for the dmap, and podcasts plugins.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=711243

 src/lua-factory/grl-lua-factory.c |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/lua-factory/grl-lua-factory.c b/src/lua-factory/grl-lua-factory.c
index be392d1..ed7f25c 100644
--- a/src/lua-factory/grl-lua-factory.c
+++ b/src/lua-factory/grl-lua-factory.c
@@ -160,6 +160,9 @@ grl_lua_factory_plugin_init (GrlRegistry *registry,
       continue;
     }
 
+    /* In case the plugin gets unref'ed during registration */
+    g_object_add_weak_pointer (G_OBJECT (source), (gpointer *) &source);
+
     if (!grl_registry_register_source (registry, plugin,
                                        GRL_SOURCE (source), &err)) {
       GRL_DEBUG ("Fail to register source: %s", err->message);
@@ -167,6 +170,10 @@ grl_lua_factory_plugin_init (GrlRegistry *registry,
       continue;
     }
 
+    if (!source)
+      continue;
+
+    g_object_remove_weak_pointer (G_OBJECT (source), (gpointer *) &source);
     source_loaded = TRUE;
     GRL_DEBUG ("Successfully initialized: %s",
                grl_source_get_id (GRL_SOURCE (source)));


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