diff --git a/camel/providers/imapx/camel-imapx-server.c b/camel/providers/imapx/camel-imapx-server.c
index fc5de5d..ce6b255 100644
--- a/camel/providers/imapx/camel-imapx-server.c
+++ b/camel/providers/imapx/camel-imapx-server.c
@@ -5297,8 +5297,7 @@ imapx_parser_thread (gpointer d)
 
 		if (is->parser_quit)
 			g_cancellable_cancel (cancellable);
-
-		if (g_cancellable_is_cancelled (cancellable)) {
+		else if (g_cancellable_is_cancelled (cancellable)) {
 			gint is_empty;
 
 			QUEUE_LOCK (is);
@@ -5336,8 +5335,8 @@ imapx_parser_thread (gpointer d)
 	QUEUE_UNLOCK (is);
 
 	is->parser_quit = FALSE;
-
-	g_signal_emit (is, signals[SHUTDOWN], 0);
+	if (is->state != IMAPX_SHUTDOWN)
+		g_signal_emit (is, signals[SHUTDOWN], 0);
 
 	return NULL;
 }
