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:
parent
062e966138
commit
ca4bdb6b3a
1 changed files with 4 additions and 1 deletions
|
|
@ -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
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue