changeset 8254:8a9a6eb3ded0

[gaim-migrate @ 8977] Fix a crash bug with some shadow stuff: "To reproduce: 1) Log in to AIM/Oscar. [I don't know if other protocols will cause this bug... I only use Oscar.] 2) Mouse over a buddy to display the Info pop-up window. 3) Hit cntl-D to log out while the pop-up is still displayed... a "remnant" of the window will remain - it appears to be the window's drop shadow. 4) Click the "remnant" - segfault is immediate. Mousing over the remnant may also cause the segfault." committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sat, 14 Feb 2004 15:11:17 +0000
parents 0c5977fd3101
children 4de49af535b3
files src/gtkblist.c
diffstat 1 files changed, 23 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkblist.c	Fri Feb 13 08:23:10 2004 +0000
+++ b/src/gtkblist.c	Sat Feb 14 15:11:17 2004 +0000
@@ -418,6 +418,7 @@
 
 /**************** END WEIRD DROP SHADOW STUFF ***********************************/
 #endif
+
 static GSList *blist_prefs_callbacks = NULL;
 
 /***************************************************
@@ -1703,6 +1704,24 @@
 	return;
 }
 
+static void gaim_gtk_blist_tooltip_destroy()
+{
+	if (gtkblist->tipwindow == NULL)
+		return;
+
+	gtk_widget_destroy(gtkblist->tipwindow);
+	gtkblist->tipwindow = NULL;
+#ifdef WANT_DROP_SHADOW
+	gdk_window_set_user_data (gtkblist->east_shadow, NULL);
+	gdk_window_destroy (gtkblist->east_shadow);
+	gtkblist->east_shadow = NULL;
+
+	gdk_window_set_user_data (gtkblist->south_shadow, NULL);
+	gdk_window_destroy (gtkblist->south_shadow);
+	gtkblist->south_shadow = NULL;
+#endif
+}
+
 static gboolean gaim_gtk_blist_tooltip_timeout(GtkWidget *tv)
 {
 	GtkTreePath *path;
@@ -1873,20 +1892,7 @@
 		if ((event->y > gtkblist->tip_rect.y) && ((event->y - gtkblist->tip_rect.height) < gtkblist->tip_rect.y))
 			return FALSE;
 		/* We've left the cell.  Remove the timeout and create a new one below */
-		if (gtkblist->tipwindow) {
-			gtk_widget_destroy(gtkblist->tipwindow);
-#ifdef WANT_DROP_SHADOW
-			  gdk_window_set_user_data (gtkblist->east_shadow, NULL);
-			  gdk_window_destroy (gtkblist->east_shadow);
-			  gtkblist->east_shadow = NULL;
-
-			  gdk_window_set_user_data (gtkblist->south_shadow, NULL);
-			  gdk_window_destroy (gtkblist->south_shadow);
-			  gtkblist->south_shadow = NULL;
-#endif
-			gtkblist->tipwindow = NULL;
-		}
-
+		gaim_gtk_blist_tooltip_destroy();
 		g_source_remove(gtkblist->timeout);
 	}
 	
@@ -1913,19 +1919,7 @@
 		g_source_remove(gtkblist->timeout);
 		gtkblist->timeout = 0;
 	}
-	if (gtkblist->tipwindow) {
-		gtk_widget_destroy(gtkblist->tipwindow);
-#ifdef WANT_DROP_SHADOW
-		gdk_window_set_user_data (gtkblist->east_shadow, NULL);
-		gdk_window_destroy (gtkblist->east_shadow);
-		gtkblist->east_shadow = NULL;
-
-		gdk_window_set_user_data (gtkblist->south_shadow, NULL);
-		gdk_window_destroy (gtkblist->south_shadow);
-		gtkblist->south_shadow = NULL;
-#endif
-		gtkblist->tipwindow = NULL;
-	}
+	gaim_gtk_blist_tooltip_destroy();
 
 	if (gtkblist->mouseover_contact && 
 	    !((e->x > gtkblist->contact_rect.x) && (e->x < (gtkblist->contact_rect.x + gtkblist->contact_rect.width)) &&
@@ -3384,8 +3378,7 @@
 
 	gtk_widget_destroy(gtkblist->window);
 
-	if (gtkblist->tipwindow)
-		gtk_widget_destroy(gtkblist->tipwindow);
+	gaim_gtk_blist_tooltip_destroy();
 
 	gtk_object_sink(GTK_OBJECT(gtkblist->tooltips));
 
@@ -3400,7 +3393,7 @@
 	gtkblist->treemodel = NULL;
 	gtkblist->idle_column = NULL;
 	gtkblist->warning_column = gtkblist->buddy_icon_column = NULL;
-	gtkblist->bbox = gtkblist->tipwindow = NULL;
+	gtkblist->bbox = NULL;
 	g_object_unref(G_OBJECT(gtkblist->ift));
 	protomenu = NULL;
 	awaymenu = NULL;