[gtk+] combobox: Fix reentrancy in gtk_combo_box_popdown()



commit 246e6cd0b9693cc9d3c7655ee42b288dab0db0b2
Author: Carlos Garnacho <carlosg gnome org>
Date:   Thu Jun 5 21:09:46 2014 +0200

    combobox: Fix reentrancy in gtk_combo_box_popdown()
    
    If called when already popped down, warnings would be issued due
    to priv->grab_pointer being unexpectedly NULL, this would happen
    in regular operation when selecting items in appears-as-list mode.
    
    So both add a NULL check for priv->grab_pointer, and bail out early
    if the popup window is already hidden.

 gtk/gtkcombobox.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index 2404886..fd6e922 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -2546,9 +2546,13 @@ gtk_combo_box_popdown (GtkComboBox *combo_box)
   if (!gtk_widget_get_realized (GTK_WIDGET (combo_box)))
     return;
 
+  if (!gtk_widget_is_drawable (priv->popup_window))
+    return;
+
   if (priv->grab_keyboard)
     gdk_device_ungrab (priv->grab_keyboard, GDK_CURRENT_TIME);
-  gdk_device_ungrab (priv->grab_pointer, GDK_CURRENT_TIME);
+  if (priv->grab_pointer)
+    gdk_device_ungrab (priv->grab_pointer, GDK_CURRENT_TIME);
 
   gtk_widget_hide (priv->popup_window);
   gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->button),


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