Browse Source

macOS: Fixed a crash in a recent commit when an on-desktop component is deleted

tags/2021-05-28
hogliux 7 years ago
parent
commit
2362ca9125
1 changed files with 6 additions and 1 deletions
  1. +6
    -1
      modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm

+ 6
- 1
modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm View File

@@ -71,6 +71,7 @@ class NSViewComponentPeer : public ComponentPeer,
public:
NSViewComponentPeer (Component& comp, const int windowStyleFlags, NSView* viewToAttachTo)
: ComponentPeer (comp, windowStyleFlags),
safeComponent (&comp),
isSharedWindow (viewToAttachTo != nil),
lastRepaintTime (Time::getMillisecondCounter())
{
@@ -702,7 +703,10 @@ public:
void redirectWillMoveToWindow (NSWindow* newWindow)
{
if ([view window] == window && newWindow == nullptr)
getComponent().setVisible (false);
{
if (auto* comp = safeComponent.get())
comp->setVisible (false);
}
}
void sendMouseEvent (NSEvent* ev)
@@ -1382,6 +1386,7 @@ public:
//==============================================================================
NSWindow* window = nil;
NSView* view = nil;
WeakReference<Component> safeComponent;
bool isSharedWindow = false, fullScreen = false;
bool isWindowInKioskMode = false;
#if USE_COREGRAPHICS_RENDERING


Loading…
Cancel
Save