macOS: Fix leaked NSMutableArray in applicationActivationChanged

The +[NSObject new] method is a combination of alloc and init.

Fixes: QTBUG-95619
Pick-to: 6.2 6.1 5.15
Change-Id: I341f8a3958fb7a016cf4c346750ea6d46eeebe9f
Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
bb10
Tor Arne Vestbø 2021-08-07 13:01:33 +02:00
parent b2f00dfb46
commit ab70aa362e
1 changed files with 1 additions and 1 deletions

View File

@ -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