gtkplacessidebar: protect for checking a null event
We are using the current gtk event position to check if the user clicked in the eject button of a row. However, we are calling this in row-activated signal, which can happens when the gtk+ mainloop already removed the "current" event, and therefore we were trying to access a null event position which crashes the sidebar. To fix it check if we have as current event, and if not, we will not check for the position. But it's better than crashing, and shouldn't happen too much. https://bugzilla.gnome.org/show_bug.cgi?id=754995
This commit is contained in:
@@ -1423,7 +1423,8 @@ clicked_eject_button (GtkPlacesSidebar *sidebar,
|
||||
GdkEvent *event = gtk_get_current_event ();
|
||||
GdkEventButton *button_event = (GdkEventButton *) event;
|
||||
|
||||
if ((event->type == GDK_BUTTON_PRESS || event->type == GDK_BUTTON_RELEASE) &&
|
||||
if (event != NULL &&
|
||||
(event->type == GDK_BUTTON_PRESS || event->type == GDK_BUTTON_RELEASE) &&
|
||||
over_eject_button (sidebar, button_event->x, button_event->y, path))
|
||||
return TRUE;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user