[gimp/gimp-2-10] app: fix a segmentation fault crash.



commit 9aa0cd2a4f5c021816dd989dca48ecdc4698a5c9
Author: Jehan <jehan girinstud io>
Date:   Fri Jan 3 21:26:21 2020 +0100

    app: fix a segmentation fault crash.
    
    gtk_widget_get_window() may return NULL. I had the case when opening
    some menus in bottom of tool options (like the "Save|Restore Tool
    Preset" menus). We must check this before doing anything with it.
    
    (cherry picked from commit 0a28534a905baaf395d29b16b6b82a176ebc9e47)

 app/widgets/gimpuimanager.c | 22 +++++++++++++---------
 1 file changed, 13 insertions(+), 9 deletions(-)
---
diff --git a/app/widgets/gimpuimanager.c b/app/widgets/gimpuimanager.c
index 9d0521c5d7..59c795cc33 100644
--- a/app/widgets/gimpuimanager.c
+++ b/app/widgets/gimpuimanager.c
@@ -1052,18 +1052,22 @@ gimp_ui_manager_item_key_press (GtkWidget     *widget,
         {
           GtkWidget *parent = gtk_widget_get_parent (widget);
           GdkWindow *window = gtk_widget_get_window (parent);
-          gint       x, y;
 
-          gdk_window_get_pointer (window, &x, &y, NULL);
-          menu_item = find_widget_under_pointer (window, &x, &y);
-
-          if (menu_item && ! GTK_IS_MENU_ITEM (menu_item))
+          if (window)
             {
-              menu_item = gtk_widget_get_ancestor (menu_item,
-                                                   GTK_TYPE_MENU_ITEM);
+              gint x, y;
+
+              gdk_window_get_pointer (window, &x, &y, NULL);
+              menu_item = find_widget_under_pointer (window, &x, &y);
+
+              if (menu_item && ! GTK_IS_MENU_ITEM (menu_item))
+                {
+                  menu_item = gtk_widget_get_ancestor (menu_item,
+                                                       GTK_TYPE_MENU_ITEM);
 
-              if (! GTK_IS_MENU_ITEM (menu_item))
-                menu_item = NULL;
+                  if (! GTK_IS_MENU_ITEM (menu_item))
+                    menu_item = NULL;
+                }
             }
         }
 


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