[gnome-software] shell search provider: Release the app in finalize, not dispose



commit 7f5e6442765f02062267f59e89275cc5b0b2f8c5
Author: Kalev Lember <kalevlember gmail com>
Date:   Sun Jun 7 15:45:14 2015 +0200

    shell search provider: Release the app in finalize, not dispose
    
    Otherwise if dispose happens to run more than once, we get underflow
    with g_application_hold()/release().

 src/gs-shell-search-provider.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-shell-search-provider.c b/src/gs-shell-search-provider.c
index 675dfb2..155b485 100644
--- a/src/gs-shell-search-provider.c
+++ b/src/gs-shell-search-provider.c
@@ -336,12 +336,19 @@ search_provider_dispose (GObject *obj)
 
        g_clear_object (&self->object_manager);
        g_clear_object (&self->plugin_loader);
-       g_application_release (g_application_get_default ());
 
        G_OBJECT_CLASS (gs_shell_search_provider_parent_class)->dispose (obj);
 }
 
 static void
+search_provider_finalize (GObject *obj)
+{
+       g_application_release (g_application_get_default ());
+
+       G_OBJECT_CLASS (gs_shell_search_provider_parent_class)->finalize (obj);
+}
+
+static void
 gs_shell_search_provider_init (GsShellSearchProvider *self)
 {
        self->metas_cache = g_hash_table_new_full (g_str_hash, g_str_equal,
@@ -363,6 +370,7 @@ gs_shell_search_provider_class_init (GsShellSearchProviderClass *klass)
        GObjectClass *oclass = G_OBJECT_CLASS (klass);
 
        oclass->dispose = search_provider_dispose;
+       oclass->finalize = search_provider_finalize;
 }
 
 GsShellSearchProvider *


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