--- old/modules/javafx.graphics/src/main/native-glass/mac/GlassApplication.m 2017-10-13 15:11:04.000000000 +0530 +++ new/modules/javafx.graphics/src/main/native-glass/mac/GlassApplication.m 2017-10-13 15:11:04.000000000 +0530 @@ -172,58 +172,53 @@ (*env)->ExceptionDescribe(env); (*env)->ExceptionClear(env); } - - jmethodID runMethod = (*env)->GetMethodID(env, runnableClass, "run", "()V"); - if ((*env)->ExceptionCheck(env) == JNI_TRUE) - { - (*env)->ExceptionDescribe(env); - (*env)->ExceptionClear(env); - } - - if ((runnableClass != 0) && (runMethod != 0)) - { - (*env)->CallVoidMethod(env, self->jLaunchable, runMethod); + if (runnableClass) { + jmethodID runMethod = (*env)->GetMethodID(env, runnableClass, "run", "()V"); if ((*env)->ExceptionCheck(env) == JNI_TRUE) { (*env)->ExceptionDescribe(env); (*env)->ExceptionClear(env); } - else - { - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(GlassApplicationDidChangeScreenParameters) - name:NSApplicationDidChangeScreenParametersNotification - object:nil]; - - // localMonitor = [NSEvent addLocalMonitorForEventsMatchingMask: NSRightMouseDownMask - // handler:^(NSEvent *incomingEvent) { - // NSEvent *result = incomingEvent; - // NSWindow *targetWindowForEvent = [incomingEvent window]; - // LOG("NSRightMouseDownMask local"); - // return result; - // }]; - // - // globalMonitor = [NSEvent addGlobalMonitorForEventsMatchingMask: NSRightMouseDownMask - // handler:^(NSEvent *incomingEvent) { - // NSEvent *result = incomingEvent; - // NSWindow *targetWindowForEvent = [incomingEvent window]; - // NSWindow *window = [[NSApplication sharedApplication] - // windowWithWindowNumber:[incomingEvent windowNumber]]; - // NSWindow *appWindow = [[NSApplication sharedApplication] mainWindow]; - // LOG("NSRightMouseDownMask global: %p num %d win %p appwin %p", - // targetWindowForEvent, [incomingEvent windowNumber], window, - // [[NSApplication sharedApplication] mainWindow]); - // }]; + if (runMethod) { + (*env)->CallVoidMethod(env, self->jLaunchable, runMethod); + if ((*env)->ExceptionCheck(env) == JNI_TRUE) + { + (*env)->ExceptionDescribe(env); + (*env)->ExceptionClear(env); + } + else + { + [[NSNotificationCenter defaultCenter] addObserver:self + selector:@selector(GlassApplicationDidChangeScreenParameters) + name:NSApplicationDidChangeScreenParametersNotification + object:nil]; + + // localMonitor = [NSEvent addLocalMonitorForEventsMatchingMask: NSRightMouseDownMask + // handler:^(NSEvent *incomingEvent) { + // NSEvent *result = incomingEvent; + // NSWindow *targetWindowForEvent = [incomingEvent window]; + // LOG("NSRightMouseDownMask local"); + // return result; + // }]; + // + // globalMonitor = [NSEvent addGlobalMonitorForEventsMatchingMask: NSRightMouseDownMask + // handler:^(NSEvent *incomingEvent) { + // NSEvent *result = incomingEvent; + // NSWindow *targetWindowForEvent = [incomingEvent window]; + // NSWindow *window = [[NSApplication sharedApplication] + // windowWithWindowNumber:[incomingEvent windowNumber]]; + // NSWindow *appWindow = [[NSApplication sharedApplication] mainWindow]; + // LOG("NSRightMouseDownMask global: %p num %d win %p appwin %p", + // targetWindowForEvent, [incomingEvent windowNumber], window, + // [[NSApplication sharedApplication] mainWindow]); + // }]; + } + } else { + NSLog(@"ERROR: Glass could not find run() method\n"); } - } - else if (runnableClass == 0) - { + } else { NSLog(@"ERROR: Glass could not find Runnable class\n"); } - else //if (runMethod == 0) - { - NSLog(@"ERROR: Glass could not find run() method\n"); - } } (*env)->CallVoidMethod(env, self->jApplication, [GlassHelper ApplicationNotifyWillFinishLaunchingMethod]); @@ -359,7 +354,11 @@ NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; { NSUInteger count = [filenames count]; - jobjectArray files = (*env)->NewObjectArray(env, (jsize)count, [GlassHelper ClassForName:"java.lang.String" withEnv:env], NULL); + jclass stringClass = [GlassHelper ClassForName:"java.lang.String" withEnv:env]; + if (!stringClass) { + return; + } + jobjectArray files = (*env)->NewObjectArray(env, (jsize)count, stringClass, NULL); GLASS_CHECK_EXCEPTION(env); for (NSUInteger i=0; i