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

From:
Mark Jamsek <mark@jamsek.com>
Subject:
Re: tog reset search after C-l
To:
Omar Polo <op@omarpolo.com>
Cc:
gameoftrees@openbsd.org
Date:
Sun, 19 Jun 2022 02:18:46 +1000

Download raw body.

Thread
On 22-06-18 05:41pm, Omar Polo wrote:
> upon C-l (Control-L), tog refreshes the data but keeps around the
> matched_entry and search_entry.  These now points to free'd memory and
> segfaults tog when one press 'n'.
> 
> to reproduce: search for something, press C-l and then 'n'.
> 
> since C-l resets also the scroll position I figured it didn't seem
> strange to also loose the current matched entry.
> 
> ok?
> 
> diff 0fe55807cf233278482e51afcee4b60d5c974340 /home/op/w/got
> blob - 8782d2289745425a1fdaecbd1edbcab6c230e7e6
> file + tog/tog.c
> --- tog/tog.c
> +++ tog/tog.c
> @@ -2800,6 +2800,8 @@ input_log_view(struct tog_view **new_view, struct tog_
>  		s->thread_args.log_complete = 0;
>  		s->quit = 0;
>  		s->thread_args.commits_needed = view->nlines;
> +		s->matched_entry = NULL;
> +		s->search_entry = NULL;
>  		break;
>  	case 'r':
>  		if (view_is_parent_view(view))
> 

This fixes the segfault in my test.

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