Explorar o código

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.
Sam Lantinga hai 1 ano
pai
achega
42f8e94d11
Modificáronse 2 ficheiros con 2 adicións e 2 borrados
  1. 0 1
      src/video/cocoa/SDL_cocoawindow.h
  2. 2 1
      src/video/cocoa/SDL_cocoawindow.m

+ 0 - 1
src/video/cocoa/SDL_cocoawindow.h

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

+ 2 - 1
src/video/cocoa/SDL_cocoawindow.m

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