mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-01-25 18:21:11 +00:00
Fix Main Thread Checker warning on macOS
Cache off NSWindow's windowNumber in SDL_WindowData on setup and use that in `Cocoa_SendWakeupEvent` to prevent accessing windowNumber off the main thread.
This commit is contained in:
parent
31d38f2f30
commit
1f276a5148
|
@ -549,13 +549,11 @@ Cocoa_PumpEvents(_THIS)
|
||||||
void Cocoa_SendWakeupEvent(_THIS, SDL_Window *window)
|
void Cocoa_SendWakeupEvent(_THIS, SDL_Window *window)
|
||||||
{ @autoreleasepool
|
{ @autoreleasepool
|
||||||
{
|
{
|
||||||
NSWindow *nswindow = ((__bridge SDL_WindowData *) window->driverdata).nswindow;
|
|
||||||
|
|
||||||
NSEvent* event = [NSEvent otherEventWithType: NSEventTypeApplicationDefined
|
NSEvent* event = [NSEvent otherEventWithType: NSEventTypeApplicationDefined
|
||||||
location: NSMakePoint(0,0)
|
location: NSMakePoint(0,0)
|
||||||
modifierFlags: 0
|
modifierFlags: 0
|
||||||
timestamp: 0.0
|
timestamp: 0.0
|
||||||
windowNumber: nswindow.windowNumber
|
windowNumber: ((__bridge SDL_WindowData *) window->driverdata).window_number
|
||||||
context: nil
|
context: nil
|
||||||
subtype: 0
|
subtype: 0
|
||||||
data1: 0
|
data1: 0
|
||||||
|
|
|
@ -126,6 +126,7 @@ typedef enum
|
||||||
@property (nonatomic) NSMutableArray *nscontexts;
|
@property (nonatomic) NSMutableArray *nscontexts;
|
||||||
@property (nonatomic) SDL_bool created;
|
@property (nonatomic) SDL_bool created;
|
||||||
@property (nonatomic) SDL_bool inWindowFullscreenTransition;
|
@property (nonatomic) SDL_bool inWindowFullscreenTransition;
|
||||||
|
@property (nonatomic) NSInteger window_number;
|
||||||
@property (nonatomic) NSInteger flash_request;
|
@property (nonatomic) NSInteger flash_request;
|
||||||
@property (nonatomic) Cocoa_WindowListener *listener;
|
@property (nonatomic) Cocoa_WindowListener *listener;
|
||||||
@property (nonatomic) SDL_VideoData *videodata;
|
@property (nonatomic) SDL_VideoData *videodata;
|
||||||
|
|
|
@ -1615,6 +1615,7 @@ SetupWindowData(_THIS, SDL_Window * window, NSWindow *nswindow, NSView *nsview,
|
||||||
data.nswindow = nswindow;
|
data.nswindow = nswindow;
|
||||||
data.created = created;
|
data.created = created;
|
||||||
data.videodata = videodata;
|
data.videodata = videodata;
|
||||||
|
data.window_number = nswindow.windowNumber;
|
||||||
data.nscontexts = [[NSMutableArray alloc] init];
|
data.nscontexts = [[NSMutableArray alloc] init];
|
||||||
data.sdlContentView = nsview;
|
data.sdlContentView = nsview;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue