diff src/imap/client.c @ 3871:2506e4077e7a HEAD

Don't crash if closing with signal while IDLEing.
author Timo Sirainen <tss@iki.fi>
date Sat, 14 Jan 2006 16:51:29 +0200
parents c1bf2b79eb7f
children 928229f8b3e6
line wrap: on
line diff
--- a/src/imap/client.c	Sat Jan 14 16:09:05 2006 +0200
+++ b/src/imap/client.c	Sat Jan 14 16:51:29 2006 +0200
@@ -62,11 +62,16 @@
 {
 	int ret;
 
+	i_assert(!client->destroyed);
+	client->destroyed = TRUE;
+
 	if (client->command_pending) {
 		/* try to deinitialize the command */
 		i_assert(client->cmd.func != NULL);
 		i_stream_close(client->input);
 		o_stream_close(client->output);
+		client->input_pending = FALSE;
+
 		ret = client->cmd.func(&client->cmd);
 		i_assert(ret);
 	}
@@ -268,7 +273,7 @@
 	   pending and we should get around to calling client_input() soon.
 	   This is mostly for APPEND/IDLE. */
 	(void)i_stream_get_data(client->input, &size);
-	if (size > 0)
+	if (size > 0 && !client->destroyed)
 		client->input_pending = TRUE;
 }