Commit 4f6de33425cfd673dafbd1c3c689bf1ecec35c27

Fix the view notification of end of reading

Move notification from update_view() to end_update() so <view>_read()
functions are also called when the user requests that loading views
are stopped. Allow ends to be forced so the extra spawning in the
blame view is closed as well.

Commit diff

tig.c

 
21632163 */
21642164
21652165static void
2166end_update(struct view *view)
2166end_update(struct view *view, bool force)
21672167{
21682168 if (!view->pipe)
21692169 return;
2170 while (!view->ops->read(view, NULL))
2171 if (!force)
2172 return;
21702173 set_nonblocking_input(FALSE);
21712174 if (view->pipe == stdin)
21722175 fclose(view->pipe);
21822182begin_update(struct view *view)
21832183{
21842184 if (view->pipe)
2185 end_update(view);
2185 end_update(view, TRUE);
21862186
21872187 if (opt_cmd[0]) {
21882188 string_copy(view->cmd, opt_cmd);
23872387check_pipe:
23882388 if (ferror(view->pipe)) {
23892389 report("Failed to read: %s", strerror(errno));
2390 goto end;
2390 end_update(view, TRUE);
23912391
23922392 } else if (feof(view->pipe)) {
23932393 report("");
2394 goto end;
2394 end_update(view, FALSE);
23952395 }
23962396
23972397 return TRUE;
23982398
23992399alloc_error:
24002400 report("Allocation failure");
2401
2402end:
2403 if (view->ops->read(view, NULL))
2404 end_update(view);
2401 end_update(view, TRUE);
24052402 return FALSE;
24062403}
24072404
28152815 view = &views[i];
28162816 if (view->pipe)
28172817 report("Stopped loading the %s view", view->name),
2818 end_update(view);
2818 end_update(view, TRUE);
28192819 }
28202820 break;
28212821
toggle raw diff