Commit Diff


commit - 41605754d020cd4be569b2dffdfac47451ea8925
commit + 276b94a1f9ff915aab767e558957527ccddf43e9
blob - 3895e44e1cc2bd3dcc96dbcbd7369ecad839c9b0
blob + 200352838ae37181b0bce33796fd9bfa11c66d34
--- tog/tog.c
+++ tog/tog.c
@@ -2031,10 +2031,6 @@ stop_log_thread(struct tog_log_view_state *s)
 			    "pthread_mutex_lock");
 		s->thread = NULL;
 	}
-
-	errcode = pthread_cond_destroy(&s->thread_args.need_commits);
-	if (errcode && err == NULL)
-		err = got_error_set_errno(errcode, "pthread_cond_destroy");
 
 	if (s->thread_args.repo) {
 		got_repo_close(s->thread_args.repo);
@@ -2054,8 +2050,18 @@ close_log_view(struct tog_view *view)
 {
 	const struct got_error *err = NULL;
 	struct tog_log_view_state *s = &view->state.log;
+	int errcode;
 
 	err = stop_log_thread(s);
+
+	errcode = pthread_cond_destroy(&s->thread_args.need_commits);
+	if (errcode && err == NULL)
+		err = got_error_set_errno(errcode, "pthread_cond_destroy");
+
+	errcode = pthread_cond_destroy(&s->thread_args.commit_loaded);
+	if (errcode && err == NULL)
+		err = got_error_set_errno(errcode, "pthread_cond_destroy");
+
 	free_commits(&s->commits);
 	free(s->in_repo_path);
 	s->in_repo_path = NULL;