[gimp] app: fix a segmentation fault crash.
- From: Jehan <jehanp src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: fix a segmentation fault crash.
- Date: Fri, 3 Jan 2020 20:33:15 +0000 (UTC)
commit 0a28534a905baaf395d29b16b6b82a176ebc9e47
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.
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 d078ea4974..b872d692a0 100644
--- a/app/widgets/gimpuimanager.c
+++ b/app/widgets/gimpuimanager.c
@@ -1130,18 +1130,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]