# HG changeset patch
# User Tim Ringenbach <marv@pidgin.im>
# Date 1128472086 0
# Node ID 311a743df5caf76580a4961172b058bba5ffb7e2
# Parent  69bd7af50d31a3f5dd1792d1ba9759bd69282ed7
[gaim-migrate @ 13884]
fix a crash on getting an im after you close a window with the person
by closing the whole window rather than the conversation.

committer: Tailor Script <tailor@pidgin.im>

diff -r 69bd7af50d31 -r 311a743df5ca src/gtkconv.c
--- a/src/gtkconv.c	Tue Oct 04 13:52:09 2005 +0000
+++ b/src/gtkconv.c	Wed Oct 05 00:28:06 2005 +0000
@@ -6191,6 +6191,20 @@
 {
 	window_list = g_list_remove(window_list, win);
 
+	if (win->gtkconvs) {
+		while (win->gtkconvs) {
+			GList *nextgtk = win->gtkconvs->next;
+			GaimGtkConversation *gtkconv = win->gtkconvs->data;
+			GList *nextcore = gtkconv->convs->next;
+			GaimConversation *conv = gtkconv->convs->data;
+			gaim_conversation_destroy(conv);
+			if (!nextgtk && !nextcore)
+			/* we'll end up invoking ourselves when we destroy our last child */
+			/* so don't destroy ourselves right now */
+				return;
+		}
+		return;
+	}
 	gtk_widget_destroy(win->window);
 
 	g_object_unref(G_OBJECT(win->menu.item_factory));