popup: check for expired weak ptr (#13352)

onCommit can destroy popups while the vector CPY still holds a weak ptr
to it, check if the weak ptr is still valid
This commit is contained in:
Tom Englund 2026-02-24 12:20:29 +01:00 committed by GitHub
parent ae82a55400
commit 8ab4d1dc06
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -403,7 +403,7 @@ void CPopup::recheckChildrenRecursive() {
std::vector<WP<CPopup>> cpy;
std::ranges::for_each(m_children, [&cpy](const auto& el) { cpy.emplace_back(el); });
for (auto const& c : cpy) {
if (!c->visible())
if (!c || !c->visible())
continue;
c->onCommit(true);
c->recheckChildrenRecursive();