Procházet zdrojové kódy

cocoa: Just update the OpenGL context directly if on the main thread.

Ryan C. Gordon před 5 roky
rodič
revize
f2ff953ef7
1 změnil soubory, kde provedl 5 přidání a 1 odebrání
  1. 5 1
      src/video/cocoa/SDL_cocoaopengl.m

+ 5 - 1
src/video/cocoa/SDL_cocoaopengl.m

@@ -66,7 +66,11 @@
     int value = SDL_AtomicSet(&self->dirty, 0);
     if (value > 0) {
         /* We call the real underlying update here, since -[SDLOpenGLContext update] just calls us. */
-        [super performSelectorOnMainThread:@selector(update) withObject:nil waitUntilDone:NO];
+        if ([NSThread isMainThread]) {
+            [super update];
+        } else {
+            [super performSelectorOnMainThread:@selector(update) withObject:nil waitUntilDone:NO];
+        }
     }
 }