[gnome-software: 2/4] gs-extras-page: Break out of loop after removing a row




commit 5e6bb2045666e0993d827b57dfd3d3c66e972d24
Author: Philip Withnall <pwithnall endlessos org>
Date:   Wed Oct 13 12:27:03 2021 +0100

    gs-extras-page: Break out of loop after removing a row
    
    When searching for duplicate applications, we can assume (by induction)
    that there will only be one duplicate instance of an app. Accordingly,
    break out of the loop when that instance is removed (before adding the
    new version of the app).
    
    This fixes an issue where the next iteration of the loop would call
    `gtk_widget_get_next_sibling()` on a widget which had just been
    destroyed as a result of being removed from the list.
    
    Signed-off-by: Philip Withnall <pwithnall endlessos org>
    
    Fixes: #1473

 src/gs-extras-page.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
---
diff --git a/src/gs-extras-page.c b/src/gs-extras-page.c
index dc74171a4..cb94ccb35 100644
--- a/src/gs-extras-page.c
+++ b/src/gs-extras-page.c
@@ -305,8 +305,10 @@ gs_extras_page_add_app (GsExtrasPage *self, GsApp *app, GsAppList *list, SearchD
                        continue;
 
                existing_app = gs_app_row_get_app (GS_APP_ROW (child));
-               if (app == existing_app)
+               if (app == existing_app) {
                        gtk_list_box_remove (GTK_LIST_BOX (self->list_box_results), child);
+                       break;
+               }
        }
 
        app_row = gs_app_row_new (app);


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