diff --git a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm index 58205af1cd..b6573e5c68 100644 --- a/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm +++ b/modules/juce_gui_basics/native/juce_mac_NSViewComponentPeer.mm @@ -126,10 +126,11 @@ public: | NSTrackingEnabledDuringMouseDrag | NSTrackingActiveAlways | NSTrackingInVisibleRect; - [view addTrackingArea: [[NSTrackingArea alloc] initWithRect: r - options: options - owner: view - userInfo: nil]]; + const NSUniquePtr trackingArea { [[NSTrackingArea alloc] initWithRect: r + options: options + owner: view + userInfo: nil] }; + [view addTrackingArea: trackingArea.get()]; notificationCenter = [NSNotificationCenter defaultCenter];