commit - e04a980e54439290d1ffcaa6a4da95e831e64291
commit + 898648181dd6ed59dececc949b45712b94a7b281
blob - a8666e58c960ce7edf68ddc3087b45020ece0e82
blob + b32d0a7f3aad5392848b305c18794c596d91e2ce
--- tog/tog.c
+++ tog/tog.c
if (err)
break;
if (dead_view) {
- struct tog_view *v;
+ struct tog_view *v, *t;
TAILQ_REMOVE(&views, dead_view, entry);
- TAILQ_FOREACH(v, &views, entry) {
- if (v->parent == dead_view)
- v->parent = NULL;
+ TAILQ_FOREACH_SAFE(v, &views, entry, t) {
+ if (v->parent == dead_view) {
+ TAILQ_REMOVE(&views, v, entry);
+ view_close(v);
+ }
}
if (dead_view->parent)
view = dead_view->parent;
else
view = TAILQ_LAST(&views, tog_view_list_head);
- if (dead_view->child) {
- TAILQ_REMOVE(&views, dead_view->child, entry);
- err = view_close(dead_view->child);
- if (err)
- goto done;
- }
err = view_close(dead_view);
if (err)
goto done;