[gtk/label-copy-link-fix: 2/2] menusectionbox: Avoid a critical warning




commit e0c7d7daebffd86a8c5910e4fa7ec2c54d93fbbf
Author: Matthias Clasen <mclasen redhat com>
Date:   Sat Aug 1 22:03:06 2020 -0400

    menusectionbox: Avoid a critical warning
    
    The popover may already be gone when the item
    is activated. Don't trigger a critical in that
    case.
    
    Related: #2986

 gtk/gtkmenusectionbox.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkmenusectionbox.c b/gtk/gtkmenusectionbox.c
index bdcab6c80c..916ef54c47 100644
--- a/gtk/gtkmenusectionbox.c
+++ b/gtk/gtkmenusectionbox.c
@@ -189,8 +189,9 @@ gtk_popover_item_activate (GtkWidget *button,
       /* Activating the item could cause the popover
        * to be free'd, for example if it is a Quit item
        */
-      popover = g_object_ref (gtk_widget_get_ancestor (button,
-                                                       GTK_TYPE_POPOVER));
+      popover = gtk_widget_get_ancestor (button, GTK_TYPE_POPOVER);
+      if (popover)
+        g_object_ref (popover);
     }
 
   gtk_menu_tracker_item_activated (item);


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