diff --git a/src/sview/common.c b/src/sview/common.c
index b39f1c78f64205f99d8090350c6b3e83e8c71e3a..9f38847c79a1eb1e611571f2905552d23140473c 100644
--- a/src/sview/common.c
+++ b/src/sview/common.c
@@ -1746,12 +1746,14 @@ extern void *popup_thr(popup_info_t *popup_win)
 	}
 	/* this will switch to 0 when popup is closed. */
 	popup_win->running = &running;
-	/* when popup is killed toggled will be set to -1 */
+	/* when popup is killed running will be set to 0 */
 	while(running) {
 		//g_print("locked popup_thr\n");
 		gdk_threads_enter();
-		if(!running)
+		if(!running) {
+			gdk_threads_leave();
 			break;
+		}
 		(specifc_info)(popup_win);
 		//gdk_flush();
 		gdk_threads_leave();