"GOT", but the "O" is a cute, smiling pufferfish. Index | Thread | Search

From:
Mark Jamsek <mark@jamsek.com>
Subject:
tog: check show_log_view() calls for failure
To:
gameoftrees@openbsd.org
Date:
Tue, 03 Dec 2024 17:19:42 +1100

Download raw body.

Thread
Last one for now :)

Fix a few instances of calling show_log_view() without checking
for failure.


commit e0ddd7157595c4170db368174b848adc889c937a
from: Mark Jamsek <mark@jamsek.dev>
date: Tue Dec  3 05:39:10 2024 UTC

tog: check show_log_view() calls for failure

M  tog/tog.c  |  15+  5-

1 file changed, 15 insertions(+), 5 deletions(-)

commit - ffeca109afd790546195ecbc4dc721e319d5211b
commit + e0ddd7157595c4170db368174b848adc889c937a
blob - baee88c98e9574ccb82d6365b7fe0935c8cc6a72
blob + da4acdccedd58c23eba516b9873506c7b2cdf4c2
--- tog/tog.c
+++ tog/tog.c
@@ -3086,6 +3086,7 @@ log_scroll_up(struct tog_log_view_state *s, int maxscr
 static const struct got_error *
 trigger_log_thread(struct tog_view *view, int wait)
 {
+	const struct got_error *err;
 	struct tog_log_thread_args *ta = &view->state.log.thread_args;
 	int errcode;
 
@@ -3108,7 +3109,9 @@ trigger_log_thread(struct tog_view *view, int wait)
 			break;
 
 		/* Display progress update in log view. */
-		show_log_view(view);
+		err = show_log_view(view);
+		if (err != NULL)
+			return err;
 		update_panels();
 		doupdate();
 
@@ -3119,7 +3122,9 @@ trigger_log_thread(struct tog_view *view, int wait)
 			    "pthread_cond_wait");
 
 		/* Display progress update in log view. */
-		show_log_view(view);
+		err = show_log_view(view);
+		if (err != NULL)
+			return err;
 		update_panels();
 		doupdate();
 	}
@@ -3749,7 +3754,9 @@ search_next_log_view(struct tog_view *view)
 	struct commit_queue_entry *entry;
 
 	/* Display progress update in log view. */
-	show_log_view(view);
+	err = show_log_view(view);
+	if (err != NULL)
+		return err;
 	update_panels();
 	doupdate();
 
@@ -5793,8 +5800,11 @@ open_diff_view(struct tog_view *view, struct got_objec
 	}
 
 	if (parent_view && parent_view->type == TOG_VIEW_LOG &&
-	    view_is_splitscreen(view))
-		show_log_view(parent_view); /* draw border */
+	    view_is_splitscreen(view)) {
+		err = show_log_view(parent_view); /* draw border */
+		if (err != NULL)
+			goto done;
+	}
 	diff_view_indicate_progress(view);
 
 	err = create_diff(s);


-- 
Mark Jamsek <https://bsdbox.org>
GPG: F2FF 13DE 6A06 C471 CA80  E6E2 2930 DC66 86EE CF68