summaryrefslogtreecommitdiff
path: root/gtk/gtktooltip.c
diff options
context:
space:
mode:
authorRui Matos <tiagomatos@gmail.com>2011-10-22 17:38:29 +0100
committerRui Matos <tiagomatos@gmail.com>2011-10-23 16:26:18 +0100
commitd56484f6ed010d020df5d1f09b330746cc894480 (patch)
treea7b1a68ec78752bfa5c4063ea1b616ee7d8034a6 /gtk/gtktooltip.c
parent5c4f2ef0c1e658827091aadf4fc3c4d5f5964785 (diff)
downloadgtk+-d56484f6ed010d020df5d1f09b330746cc894480.tar.gz
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. https://bugzilla.gnome.org/show_bug.cgi?id=662467
Diffstat (limited to 'gtk/gtktooltip.c')
-rw-r--r--gtk/gtktooltip.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c
index 29f4630d42..2ca77489c0 100644
--- a/gtk/gtktooltip.c
+++ b/gtk/gtktooltip.c
@@ -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);
@@ -633,6 +634,14 @@ maybe_update_shape (GtkTooltip *tooltip)
}
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)
{