From ea8dcbf9ec6a3e2b28c4615c4aa26edab6efe523 Mon Sep 17 00:00:00 2001 From: Graham Date: Sat, 7 Sep 2019 16:30:00 +0100 Subject: [PATCH] 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. --- gl-natives/src/main/c/jaggl.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/gl-natives/src/main/c/jaggl.c b/gl-natives/src/main/c/jaggl.c index 93973c69..bcc1f401 100644 --- a/gl-natives/src/main/c/jaggl.c +++ b/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_observer = [[NSNotificationCenter defaultCenter] addObserverForName:NSViewFrameDidChangeNotification object:jaggl_view queue:nil usingBlock:^(NSNotification *note) { - [jaggl_context_appkit update]; + if (jaggl_context_appkit) { + [jaggl_context_appkit update]; + } }]; }