mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05: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:
parent
68061f999a
commit
50e090071c
1 changed files with 3 additions and 0 deletions
|
@ -183,6 +183,9 @@ void WindowSwitcher::draw()
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t index = 0; index < m_windows.size(); ++index) {
|
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& window = *m_windows.at(index);
|
||||||
auto item_rect = this->item_rect(index);
|
auto item_rect = this->item_rect(index);
|
||||||
Color text_color;
|
Color text_color;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue