Commit d56484f6 authored by Rui Matos's avatar Rui Matos

tooltip: only update shape if the window is realized

If we get a composited-changed signal before the tooltip is ever realized we
have nothing to do.

This actually prevents a segfault in maybe_update_shape() because calling
gtk_widget_get_window() on a non-realized widget returns NULL.
parent 5c4f2ef0
......@@ -159,7 +159,8 @@ static gboolean gtk_tooltip_paint_window (GtkTooltip *tooltip,
cairo_t *cr);
static void gtk_tooltip_realize_window (GtkTooltip *tooltip,
GtkWidget *widget);
static void maybe_update_shape (GtkTooltip *tooltip);
static void gtk_tooltip_composited_changed (GtkTooltip *tooltip,
GtkWidget *widget);
static void gtk_tooltip_window_hide (GtkWidget *widget,
gpointer user_data);
static void gtk_tooltip_display_closed (GdkDisplay *display,
......@@ -228,7 +229,7 @@ gtk_tooltip_init (GtkTooltip *tooltip)
g_signal_connect_swapped (window, "realize",
G_CALLBACK (gtk_tooltip_realize_window), tooltip);
g_signal_connect_swapped (window, "composited-changed",
G_CALLBACK (maybe_update_shape), tooltip);
G_CALLBACK (gtk_tooltip_composited_changed), tooltip);
/* FIXME: don't hardcode the padding */
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
......@@ -632,6 +633,14 @@ maybe_update_shape (GtkTooltip *tooltip)
cairo_region_destroy (region);
static void
gtk_tooltip_composited_changed (GtkTooltip *tooltip,
GtkWidget *widget)
if (gtk_widget_get_realized (tooltip->window))
maybe_update_shape (tooltip);
static void
gtk_tooltip_realize_window (GtkTooltip *tooltip,
GtkWidget *widget)
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment