Commit 239fd8ac authored by Kristian Rietveld's avatar Kristian Rietveld Committed by Kristian Rietveld

use a weak pointer to set last_window to NULL as soon as it's destroyed.

2007-12-17  Kristian Rietveld  <kris@imendio.com>

	* gtk/gtktooltip.c (gtk_tooltip_finalize),
	(gtk_tooltip_set_last_window): use a weak pointer to set last_window
	to NULL as soon as it's destroyed.  (#496546, patch from
	Benjamin Berg).


svn path=/trunk/; revision=19189
parent c3b2b3ed
2007-12-17 Kristian Rietveld <kris@imendio.com>
* gtk/gtktooltip.c (gtk_tooltip_finalize),
(gtk_tooltip_set_last_window): use a weak pointer to set last_window
to NULL as soon as it's destroyed. (#496546, patch from
Benjamin Berg).
2007-12-17 Kristian Rietveld <kris@imendio.com>
* gtk/gtktreeviewcolumn.c (gtk_tree_view_column_update_button):
......
......@@ -92,6 +92,8 @@ static void gtk_tooltip_window_hide (GtkWidget *widget,
static void gtk_tooltip_display_closed (GdkDisplay *display,
gboolean was_error,
GtkTooltip *tooltip);
static void gtk_tooltip_set_last_window (GtkTooltip *tooltip,
GdkWindow *window);
G_DEFINE_TYPE (GtkTooltip, gtk_tooltip, G_TYPE_OBJECT);
......@@ -179,6 +181,8 @@ gtk_tooltip_finalize (GObject *object)
tooltip->browse_mode_timeout_id = 0;
}
gtk_tooltip_set_last_window (tooltip, NULL);
if (tooltip->window)
{
GdkDisplay *display;
......@@ -734,6 +738,21 @@ gtk_tooltip_display_closed (GdkDisplay *display,
g_object_set_data (G_OBJECT (display), "gdk-display-current-tooltip", NULL);
}
static void
gtk_tooltip_set_last_window (GtkTooltip *tooltip,
GdkWindow *window)
{
if (tooltip->last_window)
g_object_remove_weak_pointer (G_OBJECT (tooltip->last_window),
(gpointer *) &tooltip->last_window);
tooltip->last_window = window;
if (window)
g_object_add_weak_pointer (G_OBJECT (tooltip->last_window),
(gpointer *) &tooltip->last_window);
}
static gboolean
gtk_tooltip_run_requery (GtkWidget **widget,
GtkTooltip *tooltip,
......@@ -1190,7 +1209,7 @@ _gtk_tooltip_handle_event (GdkEvent *event)
if (current_tooltip)
{
current_tooltip->last_window = event->any.window;
gtk_tooltip_set_last_window (current_tooltip, event->any.window);
gdk_event_get_root_coords (event,
&current_tooltip->last_x,
&current_tooltip->last_y);
......@@ -1298,7 +1317,7 @@ _gtk_tooltip_handle_event (GdkEvent *event)
G_CALLBACK (gtk_tooltip_display_closed),
current_tooltip);
current_tooltip->last_window = event->any.window;
gtk_tooltip_set_last_window (current_tooltip, event->any.window);
gdk_event_get_root_coords (event,
&current_tooltip->last_x,
&current_tooltip->last_y);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment