[gnome-software] Fix a refcounting error



commit 71e1e8561c0e3e36f0e68d4351976db3f7b7f04b
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Oct 6 13:31:14 2013 -0400

    Fix a refcounting error
    
    pending_apps has g_object_unref as free func, which means
    g_ptr_array_remove will drop a reference. That won't end well
    unless you take a reference when adding apps to the array.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=709306

 src/gs-plugin-loader.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 1065ffb..01267bc 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -1750,7 +1750,7 @@ gs_plugin_loader_thread_func (gpointer user_data)
        /* add to list */
        gs_app_set_state_in_idle (helper->app, helper->state_progress);
        g_mutex_lock (&helper->plugin_loader->priv->pending_apps_mutex);
-       g_ptr_array_add (helper->plugin_loader->priv->pending_apps, helper->app);
+       g_ptr_array_add (helper->plugin_loader->priv->pending_apps, g_object_ref (helper->app));
        g_mutex_unlock (&helper->plugin_loader->priv->pending_apps_mutex);
        g_idle_add (emit_pending_apps_idle, g_object_ref (helper->plugin_loader));
 


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