summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Gorodnichev <[email protected]>2014-10-13 00:24:10 +0400
committerStefano Karapetsas <[email protected]>2014-10-13 09:02:55 +0200
commit9144c25beaf0fe63cb668c730bbaaa532069c2d3 (patch)
treef4259cd4d5a2c299d1a8f5f099a0bb4546fefc93
parente08a6727b5a071f3740543fd900ae60b696c3d72 (diff)
downloadmate-panel-9144c25beaf0fe63cb668c730bbaaa532069c2d3.tar.bz2
mate-panel-9144c25beaf0fe63cb668c730bbaaa532069c2d3.tar.xz
Fix segfault: gtk_get_current_event can return null
fix segfault when gtk_get_current_event return null fix memory leak: gtk_get_current_event return value must be freed Closes https://github.com/mate-desktop/mate-panel/pull/243
-rw-r--r--mate-panel/panel.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/mate-panel/panel.c b/mate-panel/panel.c
index 666a62b7..ce22432e 100644
--- a/mate-panel/panel.c
+++ b/mate-panel/panel.c
@@ -351,11 +351,14 @@ panel_popup_menu (PanelToplevel *toplevel,
panel_data = g_object_get_data (G_OBJECT (toplevel), "PanelData");
current_event = gtk_get_current_event ();
- if (current_event->type == GDK_BUTTON_PRESS)
+ if (current_event && current_event->type == GDK_BUTTON_PRESS)
panel_data->insertion_pos = panel_widget_get_cursorloc (panel_widget);
else
panel_data->insertion_pos = -1;
-
+
+ if (current_event)
+ gdk_event_free (current_event);
+
menu = make_popup_panel_menu (panel_widget);
if (!menu)
return FALSE;