1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

Component: Avoid calling member functions on objects destroyed when exiting modal state

This commit is contained in:
reuk 2021-11-17 17:11:50 +00:00
parent 062e966138
commit ca4bdb6b3a
No known key found for this signature in database
GPG key ID: FCB43929F012EE5C

View file

@ -1761,6 +1761,8 @@ void Component::enterModalState (bool shouldTakeKeyboardFocus,
void Component::exitModalState (int returnValue)
{
WeakReference<Component> deletionChecker (this);
if (isCurrentlyModal (false))
{
if (MessageManager::getInstance()->isThisTheMessageThread())
@ -1772,7 +1774,8 @@ void Component::exitModalState (int returnValue)
// While this component is in modal state it may block other components from receiving
// mouseEnter events. To keep mouseEnter and mouseExit calls balanced on these components,
// we must manually force the mouse to "enter" blocked components.
ComponentHelpers::sendMouseEventToComponentsThatAreBlockedByModal (*this, &Component::internalMouseEnter);
if (deletionChecker != nullptr)
ComponentHelpers::sendMouseEventToComponentsThatAreBlockedByModal (*deletionChecker, &Component::internalMouseEnter);
}
else
{