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

From:
Mark Jamsek <mark@jamsek.com>
Subject:
Re: tog: todo item #2 respond to key presses while "loading..."
To:
Game of Trees <gameoftrees@openbsd.org>
Date:
Sat, 13 Aug 2022 21:49:32 +1000

Download raw body.

Thread
On 22-08-13 11:53AM, Stefan Sperling wrote:
> On Sat, Aug 13, 2022 at 11:39:17AM +0200, Stefan Sperling wrote:
> > On Fri, Aug 12, 2022 at 11:36:46PM +0200, Stefan Sperling wrote:
> > > Here is a case where movement doesn't seem to work while loading:
> > > 
> > > 	tog log path
> > > 
> > > Where path is any file in a deep history that has seen few changes.
> > > The top-level Makefile in OpenBSD src.git is one such file.
> > 
> > This can be fixed by... well, simply not waiting for the log thread.
> > 
> > In hindsight, the articicial blocking behaviour was probably a bad idea.
> > If we remove related code, the tog log view remains responsive at all times.
> > 
> > ok?
> 
> Hmm, with that change the crashes start showing up.
> 
> For starters, we need to be careful about pointers which will be NULL
> before the thread has initialized them. We can fix this already before
> actually removing any log wait code.
> 
> Ok?

Yes, ok.

> I haven't found any other issues yet, but still testing.

I just tried this with your patch from the previous mail that removes
waiting on the log thread and it seems to be working well, but I'll keep
running with it too.

> diff 11edf34c28f6c60a1d37d5c83c758e90df02fe7a f3ce181c406d83111ef235eeb1ac6bcb962cf655
> commit - 11edf34c28f6c60a1d37d5c83c758e90df02fe7a
> commit + f3ce181c406d83111ef235eeb1ac6bcb962cf655
> blob - fa53f96cb444650badb64394f0e1af4d9ea769f7
> blob + 65fe22564e7665a2c9a872b7e1e868b9ed62f0ae
> --- tog/tog.c
> +++ tog/tog.c
> @@ -3209,8 +3209,11 @@ log_move_cursor_down(struct tog_view *view, int page)
>  	 * We might necessarily overshoot in horizontal
>  	 * splits; if so, select the last displayed commit.
>  	 */
> -	s->selected = MIN(s->selected,
> -	    s->last_displayed_entry->idx - s->first_displayed_entry->idx);
> +	if (s->first_displayed_entry && s->last_displayed_entry) {
> +		s->selected = MIN(s->selected,
> +		    s->last_displayed_entry->idx -
> +		    s->first_displayed_entry->idx);
> +	}
>  
>  	select_commit(s);
>  
> @@ -3268,6 +3271,9 @@ log_goto_line(struct tog_view *view, int nlines)
>  	struct tog_log_view_state	*s = &view->state.log;
>  	int				 g, idx = s->selected_entry->idx;
>  
> +	if (s->first_displayed_entry == NULL || s->last_displayed_entry == NULL)
> +		return NULL;
> +
>  	g = view->gline;
>  	view->gline = 0;
>  
> 

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