Download raw body.
tog: 'q' exits instead of quitting view (FreeBSD)
On Sun, Nov 15, 2020 at 12:20:16AM +0100, Christian Weisgerber wrote:
> Stefan Sperling:
>
> > > I start tog log,
> > > hit 't' to switch to tree view,
> > > hit 'l' to switch to log view for a file,
> > > hit enter for the latest diff,
> > > hit 'q' and ...
> > >
> > > ... on FreeBSD, tog exits. No error. It's as if I had hit 'Q'.
> >
> > Can you find out which condition causes view_loop() to exit?
>
> dead_view == main_view && new_view == NULL
>
> It's a bug hidden by memory randomization, which FreeBSD does not
> have, at least by default.
>
> The sequence above is:
> 1. open first log view
> => this view is remembered in main_view
> 2. open tree view
> 3. open second log view, closes first log view and tree view
> => the memory of the first log view and the tree view is free()ed
> 4. open diff view
> => malloc() returns the memory previously occupied by the first
> log view
> => the new diff view now matches main_view
Hmmm. Does this fix it?
diff 8b4e047e05ed0f7d83b37ec25e4fdeb734157477 /home/stsp/src/got
blob - ed5c1bcd6b0bf2c051b4462a2c75b7a3ed9ee102
file + tog/tog.c
--- tog/tog.c
+++ tog/tog.c
@@ -988,6 +988,8 @@ view_loop(struct tog_view *view)
view = new_view;
if (focus_view == NULL)
focus_view = new_view;
+ if (dead_view == main_view)
+ main_view = new_view;
}
if (focus_view) {
show_panel(focus_view->panel);
tog: 'q' exits instead of quitting view (FreeBSD)