Commit fb59748f6b2d9108022ebf444586386f085fd134

Stefan Sperling 2020-12-05T16:58:37

garbage-collect pointless main_view variable in view_loop() This short-cut is not necessary and was buggy: The pointer was not updated even if the main view had changed. Removing this code fixes a problem on FreeBSD where pressing 'q' in a child view caused tog to exit. ok naddy

diff --git a/tog/tog.c b/tog/tog.c
index 38cc44f..1497322 100644
--- a/tog/tog.c
+++ b/tog/tog.c
@@ -959,7 +959,7 @@ view_loop(struct tog_view *view)
 {
 	const struct got_error *err = NULL;
 	struct tog_view_list_head views;
-	struct tog_view *new_view, *main_view;
+	struct tog_view *new_view;
 	int fast_refresh = 10;
 	int done = 0, errcode;
 
@@ -970,7 +970,6 @@ view_loop(struct tog_view *view)
 	TAILQ_INIT(&views);
 	TAILQ_INSERT_HEAD(&views, view, entry);
 
-	main_view = view;
 	view->focussed = 1;
 	err = view->show(view);
 	if (err)
@@ -1001,7 +1000,7 @@ view_loop(struct tog_view *view)
 				TAILQ_REMOVE(&views, view, entry);
 
 			err = view_close(view);
-			if (err || (view == main_view && new_view == NULL))
+			if (err)
 				goto done;
 
 			view = NULL;