cocoa: Just update the OpenGL context directly if on the main thread.
authorRyan C. Gordon <icculus@icculus.org>
Thu, 26 Mar 2020 13:42:56 -0400
changeset 13673be892626e1aa
parent 13672 389ce8cfa2a3
child 13674 9adcb74f0be2
cocoa: Just update the OpenGL context directly if on the main thread.
src/video/cocoa/SDL_cocoaopengl.m
     1.1 --- a/src/video/cocoa/SDL_cocoaopengl.m	Wed Mar 25 09:38:45 2020 -0700
     1.2 +++ b/src/video/cocoa/SDL_cocoaopengl.m	Thu Mar 26 13:42:56 2020 -0400
     1.3 @@ -66,7 +66,11 @@
     1.4      int value = SDL_AtomicSet(&self->dirty, 0);
     1.5      if (value > 0) {
     1.6          /* We call the real underlying update here, since -[SDLOpenGLContext update] just calls us. */
     1.7 -        [super performSelectorOnMainThread:@selector(update) withObject:nil waitUntilDone:NO];
     1.8 +        if ([NSThread isMainThread]) {
     1.9 +            [super update];
    1.10 +        } else {
    1.11 +            [super performSelectorOnMainThread:@selector(update) withObject:nil waitUntilDone:NO];
    1.12 +        }
    1.13      }
    1.14  }
    1.15