Fix potential NULL pointer dereference

... as reported in thread "Windows 11 crash (still investigating)"
of fltk.coredev, started on Apr 24, 2024.

This bug could only be triggered if a /subwindow/ wss hidden but was
not limited to Windows.
This commit is contained in:
Albrecht Schlosser 2024-04-29 16:32:13 +02:00
parent 8664fde1d9
commit b402b6a839
1 changed files with 3 additions and 2 deletions

View File

@ -592,8 +592,9 @@ int Fl_Window::handle(int ev)
// unmap because when the parent window is remapped we don't
// want to reappear.
if (visible()) {
Fl_Widget* p = parent(); for (;p->visible();p = p->parent()) {}
if (p->type() >= FL_WINDOW) break; // don't do the unmap
Fl_Widget* p = parent();
for (; p && p->visible(); p = p->parent()) { /* empty*/ }
if (p && p->as_window()) break; // don't do the unmap
}
pWindowDriver->unmap();
}