changeset 28497:de2ac0952487

Remove IO watches at shutdown in gntmain.c Closes #9872. Patch from Tomasz "desowin" Mon. committer: Paul Aurich <paul@darkrain42.org>
author desowin@gmail.com
date Sun, 30 Aug 2009 04:34:12 +0000
parents f075af99d9b5
children 37bf0bf6dfad
files COPYRIGHT ChangeLog finch/libgnt/gntmain.c
diffstat 3 files changed, 14 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/COPYRIGHT	Sun Aug 30 04:31:26 2009 +0000
+++ b/COPYRIGHT	Sun Aug 30 04:34:12 2009 +0000
@@ -307,6 +307,7 @@
 Arkadiusz Miskiewicz
 David Mohr
 Andrew Molloy
+Tomasz Mon
 Michael Monreal
 Laurent Montaron
 Marco Monteiro
--- a/ChangeLog	Sun Aug 30 04:31:26 2009 +0000
+++ b/ChangeLog	Sun Aug 30 04:34:12 2009 +0000
@@ -17,6 +17,7 @@
 
 	Finch:
 	* Properly detect libpanel on OpenBSD.  (Brad Smith)
+	* Remove IO watches in gnt_quit.  (Tomasz Mon)
 
 	Pidgin:
 	* Fix the auto-personize functionality in the Buddy List.
--- a/finch/libgnt/gntmain.c	Sun Aug 30 04:31:26 2009 +0000
+++ b/finch/libgnt/gntmain.c	Sun Aug 30 04:34:12 2009 +0000
@@ -69,7 +69,8 @@
  */
 
 static GIOChannel *channel = NULL;
-static int channel_read_callback;
+static guint channel_read_callback = 0;
+static guint channel_error_callback = 0;
 
 static gboolean ascii_only;
 static gboolean mouse_enabled;
@@ -314,11 +315,11 @@
 	channel_read_callback = result = g_io_add_watch_full(channel,  G_PRIORITY_HIGH,
 					(G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_PRI),
 					io_invoke, NULL, NULL);
-	
-	g_io_add_watch_full(channel,  G_PRIORITY_HIGH,
+
+	channel_error_callback = g_io_add_watch_full(channel,  G_PRIORITY_HIGH,
 					(G_IO_NVAL),
 					io_invoke_error, GINT_TO_POINTER(result), NULL);
-	
+
 	g_io_channel_unref(channel);  /* Apparently this caused crashes for some people.
 	                                 But irssi does this, so I am going to assume the
 	                                 crashes were caused by some other stuff. */
@@ -583,6 +584,13 @@
 
 void gnt_quit()
 {
+	/* Prevent io_invoke() from being called after wm is destroyed */
+	g_source_remove(channel_error_callback);
+	g_source_remove(channel_read_callback);
+
+	channel_error_callback = 0;
+	channel_read_callback = 0;
+
 	g_object_unref(G_OBJECT(wm));
 	wm = NULL;