1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:07:45 +00:00

WindowServer: Skip over destroyed windows in WindowSwitcher::draw()

I encountered a WindowServer crash due to null-pointer dereference in
this function, so let's protect against it by simply skipping over
nulled-out WeakPtrs.

I added a FIXME about how we ideally wouldn't be in this situation in
the first place, but that will require some more investigation.
This commit is contained in:
Andreas Kling 2021-12-25 10:39:47 +01:00
parent 68061f999a
commit 50e090071c

View file

@ -183,6 +183,9 @@ void WindowSwitcher::draw()
}
for (size_t index = 0; index < m_windows.size(); ++index) {
// FIXME: Ideally we wouldn't be in draw() without having pruned destroyed windows from the list already.
if (m_windows.at(index) == nullptr)
continue;
auto& window = *m_windows.at(index);
auto item_rect = this->item_rect(index);
Color text_color;