[libhandy/tabs: 16/62] Fix a memory error when detaching




commit 5db745f0df8e2ea45c70c23532317f16f6f171ad
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Sat Sep 5 15:07:22 2020 +0500

    Fix a memory error when detaching

 src/hdy-tab-box.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/src/hdy-tab-box.c b/src/hdy-tab-box.c
index cedfb7de..59516dca 100644
--- a/src/hdy-tab-box.c
+++ b/src/hdy-tab-box.c
@@ -1511,18 +1511,21 @@ remove_page (HdyTabBox  *self,
     return;
 
   info = page_link->data;
+  page_link = page_link->next;
 
   force_end_reordering (self);
 
   if (self->hovering) {
     gboolean is_last = TRUE;
-    GList *l;
 
-    for (l = page_link; l; l = l->next) {
-      TabInfo *i = l->data;
+    while (page_link) {
+      TabInfo *i = page_link->data;
+      page_link = page_link->next;
 
-      if (l != page_link && i->page)
+      if (i->page) {
         is_last = FALSE;
+        break;
+      }
     }
 
     if (is_last && self->tab_resize_mode != TAB_RESIZE_NORMAL)


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