mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-17 00:44:19 +00:00
NSViewComponentPeer: Fix use-after-free when closing windows with the keyboard
This commit is contained in:
parent
cac1ad8c1e
commit
e3df22a4ea
1 changed files with 7 additions and 2 deletions
|
|
@ -2333,9 +2333,14 @@ struct JuceNSViewClass final : public NSViewComponentPeerWrapper<ObjCClass<NSVie
|
|||
{
|
||||
if (auto* owner = getOwner (self))
|
||||
{
|
||||
const ScopedValueSetter scope { owner->inPerformKeyEquivalent, true };
|
||||
|
||||
const auto ref = owner->safeComponent;
|
||||
const auto prev = std::exchange (owner->inPerformKeyEquivalent, true);
|
||||
|
||||
const ScopeGuard scope { [&ref, owner, prev]
|
||||
{
|
||||
if (ref != nullptr)
|
||||
owner->inPerformKeyEquivalent = prev;
|
||||
} };
|
||||
|
||||
if (owner->sendEventToInputContextOrComponent (ev))
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue