mac: Fix SDLWindow nswindow member no longer being cleaned up in Cocoa_DestroyWindow

- A refactor changed how SetupWindowData handled external windows where previously it was tracked
  in a field of SDL_CocoaWindowData but now it is tracked by setting SDL_WINDOW_EXTERNAL in the
  window flags. Removed the now unused field and updated the external window check in DestroyWindow.
This commit is contained in:
Sam Lantinga 2024-04-23 06:20:30 -07:00
parent cfabb7a9ac
commit 42f8e94d11
2 changed files with 2 additions and 2 deletions

View File

@ -132,7 +132,6 @@ typedef enum
@property(nonatomic) NSWindow *nswindow;
@property(nonatomic) NSView *sdlContentView;
@property(nonatomic) NSMutableArray *nscontexts;
@property(nonatomic) SDL_bool created;
@property(nonatomic) BOOL in_blocking_transition;
@property(nonatomic) BOOL was_zoomed;
@property(nonatomic) NSInteger window_number;

View File

@ -2830,7 +2830,8 @@ void Cocoa_DestroyWindow(SDL_VideoDevice *_this, SDL_Window *window)
}
[data.listener close];
data.listener = nil;
if (data.created) {
if (!(window->flags & SDL_WINDOW_EXTERNAL)) {
/* Release the content view to avoid further updateLayer callbacks */
[data.nswindow setContentView:nil];
[data.nswindow close];