Skip to content
Permalink
Browse files

systray: Bail out if the plug window is gone

Instead of crashing when deferencing a NULL pointer.

GNOME/gnome-shell@0b6c5b4

Note: In Cinnamon we also had a crash at startup in Fedora/Arch/LMDE.
  • Loading branch information
clefebvre committed May 1, 2018
1 parent 0888bfb commit 420c0e006839ac850d686cc4d55ad5b6bf1c9259
Showing with 16 additions and 0 deletions.
  1. +11 −0 src/cinnamon-tray-icon.c
  2. +5 −0 src/tray/na-tray-child.c
@@ -64,6 +64,11 @@ cinnamon_tray_icon_constructed (GObject *object)
na_tray_child_get_wm_class (icon->priv->socket, NULL, &icon->priv->wm_class);

icon_app_window = gtk_socket_get_plug_window (GTK_SOCKET (icon->priv->socket));
if (icon_app_window == NULL)
{
g_warning ("cinnamon tray: icon app window is gone");
return;
}
plug_xid = GDK_WINDOW_XID (icon_app_window);

display = gtk_widget_get_display (GTK_WIDGET (icon->priv->socket));
@@ -192,6 +197,12 @@ cinnamon_tray_icon_click (CinnamonTrayIcon *icon,
gdk_error_trap_push ();

remote_window = gtk_socket_get_plug_window (GTK_SOCKET (icon->priv->socket));
if (remote_window == NULL)
{
g_warning ("cinnamon tray: plug window is gone");
gdk_error_trap_pop_ignored ();
return;
}
xwindow = GDK_WINDOW_XID (remote_window);
xdisplay = GDK_WINDOW_XDISPLAY (remote_window);
screen = gdk_window_get_screen (remote_window);
@@ -384,6 +384,11 @@ na_tray_child_force_redraw (NaTrayChild *child)
GtkAllocation allocation;

plug_window = gtk_socket_get_plug_window (GTK_SOCKET (child));
if (plug_window == NULL)
{
g_warning ("na_tray_child: plug window is gone");
return;
}
gtk_widget_get_allocation (widget, &allocation);

xev.xexpose.type = Expose;

0 comments on commit 420c0e0

Please sign in to comment.
You can’t perform that action at this time.