[gnome-software/wip/mcrha/gs-update-dialog-ui-title: 30/33] gs-update-dialog: Avoid g_object_ref() call with a NULL app




commit 89983ea91cec55feee6906e7696841ee7fac35be
Author: Milan Crha <mcrha redhat com>
Date:   Tue Nov 2 08:51:25 2021 +0100

    gs-update-dialog: Avoid g_object_ref() call with a NULL app
    
    The app can be NULL when using `gnome-software --mode=updated`, thus
    check for it and do not call the g_object_ref() in the case the app
    is NULL.

 src/gs-update-dialog.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/gs-update-dialog.c b/src/gs-update-dialog.c
index 1513e2de4..a302ef7a5 100644
--- a/src/gs-update-dialog.c
+++ b/src/gs-update-dialog.c
@@ -272,7 +272,9 @@ gs_update_dialog_set_property (GObject      *object,
                dialog->plugin_loader = g_object_ref (g_value_get_object (value));
                break;
        case PROP_APP:
-               dialog->app = g_object_ref (g_value_get_object (value));
+               dialog->app = g_value_get_object (value);
+               if (dialog->app != NULL)
+                       g_object_ref (dialog->app);
                break;
        default:
                G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);


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