Check that jaggl_context_appkit is non-NULL before update call

It is created after the observer is added, so there is a race condition.
bzip2
Graham 5 years ago
parent fb429421ed
commit ea8dcbf9ec
  1. 2
      gl-natives/src/main/c/jaggl.c

@ -1170,7 +1170,9 @@ JNIEXPORT jboolean JNICALL Java_jaggl_context_choosePixelFormat1(JNIEnv *env, jc
jaggl_view = platformInfo->view; jaggl_view = platformInfo->view;
jaggl_view_observer = [[NSNotificationCenter defaultCenter] addObserverForName:NSViewFrameDidChangeNotification object:jaggl_view queue:nil usingBlock:^(NSNotification *note) { jaggl_view_observer = [[NSNotificationCenter defaultCenter] addObserverForName:NSViewFrameDidChangeNotification object:jaggl_view queue:nil usingBlock:^(NSNotification *note) {
if (jaggl_context_appkit) {
[jaggl_context_appkit update]; [jaggl_context_appkit update];
}
}]; }];
} }

Loading…
Cancel
Save