summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2021-08-07 13:01:33 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-08-08 14:15:46 +0000
commit40c536b712556c2a47060615a4a2e3ce09ea84ec (patch)
treea73519f68a6b4a74754591610dba2bbfb279c102
parented1af43c3b2fcd533d648b4117154c8eb7f2452e (diff)
macOS: Fix leaked NSMutableArray in applicationActivationChanged
The +[NSObject new] method is a combination of alloc and init. Fixes: QTBUG-95619 Change-Id: I341f8a3958fb7a016cf4c346750ea6d46eeebe9f Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> (cherry picked from commit ab70aa362ee5dd5b1375b198dcd6d6445ab2daeb) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/plugins/platforms/cocoa/qnswindow.mm2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/plugins/platforms/cocoa/qnswindow.mm b/src/plugins/platforms/cocoa/qnswindow.mm
index d9158bbcae..27d98a3b73 100644
--- a/src/plugins/platforms/cocoa/qnswindow.mm
+++ b/src/plugins/platforms/cocoa/qnswindow.mm
@@ -106,7 +106,7 @@ static bool isMouseEvent(NSEvent *ev)
// Unfortunately there's no NSWindowListOrderedBackToFront,
// so we have to manually reverse the order using an array.
- NSMutableArray<NSWindow *> *windows = [NSMutableArray<NSWindow *> new];
+ NSMutableArray<NSWindow *> *windows = [[NSMutableArray<NSWindow *> new] autorelease];
[application enumerateWindowsWithOptions:NSWindowListOrderedFrontToBack
usingBlock:^(NSWindow *window, BOOL *) {
// For some reason AppKit will give us nil-windows, skip those