[gtk/gtk-3-24: 3/4] Further simplification




commit 4892c8901b16b533d4c583eabc805e1f2a84f33d
Author: Sergio Costas <rastersoft gmail com>
Date:   Tue Aug 16 23:14:44 2022 +0200

    Further simplification

 gtk/gtkpopover.c | 19 ++++---------------
 1 file changed, 4 insertions(+), 15 deletions(-)
---
diff --git a/gtk/gtkpopover.c b/gtk/gtkpopover.c
index 4182c5fd58..45680d0b4b 100644
--- a/gtk/gtkpopover.c
+++ b/gtk/gtkpopover.c
@@ -456,7 +456,7 @@ window_focus_in (GtkWidget  *widget,
       if (focus == NULL || !gtk_widget_is_ancestor (focus, GTK_WIDGET (popover)))
         gtk_widget_grab_focus (GTK_WIDGET (popover));
 
-      if (priv->grab_notify_blocked)
+      if (priv->grab_notify_blocked && priv->widget)
         g_signal_handler_unblock (priv->widget, priv->grab_notify_id);
 
       priv->grab_notify_blocked = FALSE;
@@ -2097,7 +2097,6 @@ gtk_popover_update_relative_to (GtkPopover *popover,
 {
   GtkPopoverPrivate *priv = popover->priv;
   GtkStateFlags old_state = 0;
-  gboolean had_grab_notify_blocked = FALSE;
 
   if (priv->widget == relative_to)
     return;
@@ -2124,14 +2123,7 @@ gtk_popover_update_relative_to (GtkPopover *popover,
       if (g_signal_handler_is_connected (priv->widget, priv->state_changed_id))
         g_signal_handler_disconnect (priv->widget, priv->state_changed_id);
       if (g_signal_handler_is_connected (priv->widget, priv->grab_notify_id))
-        {
-          if (priv->grab_notify_blocked)
-            {
-              priv->grab_notify_blocked = FALSE;
-              had_grab_notify_blocked = TRUE;
-            }
-          g_signal_handler_disconnect (priv->widget, priv->grab_notify_id);
-        }
+        g_signal_handler_disconnect (priv->widget, priv->grab_notify_id);
 
       widget_unmanage_popover (priv->widget, popover);
     }
@@ -2167,11 +2159,8 @@ gtk_popover_update_relative_to (GtkPopover *popover,
         g_signal_connect (priv->widget, "grab-notify",
                           G_CALLBACK (_gtk_popover_parent_grab_notify),
                           popover);
-      if (had_grab_notify_blocked)
-        {
-          g_signal_handler_block (priv->widget, priv->grab_notify_id);
-          priv->grab_notify_blocked = TRUE;
-        }
+      if (priv->grab_notify_blocked)
+        g_signal_handler_block (priv->widget, priv->grab_notify_id);
 
       /* Give ownership of the popover to widget */
       widget_manage_popover (priv->widget, popover);


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