[gnome-software/1587-updates-glitchy-empty-list: 11/11] gs-updates-section: Flip function call order in _unreveal_row()




commit 381fe5260add60d9f03d4a13cd91583713feec20
Author: Milan Crha <mcrha redhat com>
Date:   Thu Aug 25 08:05:41 2022 +0200

    gs-updates-section: Flip function call order in _unreveal_row()
    
    Even the order technically doesn't matter at the moment, it'll be better
    to follow the pattern to first connect to the signal and only then
    unreveal the row. That will help to avoid possible use-after-free in case
    the call to unreveal the row would emit the "unrevealed" signal immediately
    in the future, which the code currently handles as "delete the GsAppRow".

 src/gs-updates-section.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/src/gs-updates-section.c b/src/gs-updates-section.c
index a705ab8d9..68d818a6b 100644
--- a/src/gs-updates-section.c
+++ b/src/gs-updates-section.c
@@ -109,9 +109,9 @@ _row_unrevealed_cb (GObject *row, GParamSpec *pspec, gpointer data)
 static void
 _unreveal_row (GsAppRow *app_row)
 {
-       gs_app_row_unreveal (app_row);
        g_signal_connect (app_row, "unrevealed",
                          G_CALLBACK (_row_unrevealed_cb), NULL);
+       gs_app_row_unreveal (app_row);
 }
 
 static void


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