我有一个Swing
应用程序,并进行JNI
方法调用,打开NSOpenPanel
。在一些电脑上(我不知道它们之间有什么相似之处),它完全挂起了应用程序。在大多数电脑上它的工作正常。如果代码将应用程序挂在特定的Mac上,则每次执行时都会执行该代码。NSOpenPanel挂起java应用程序
这里是我如何开一个NSOpenPanel:
JNF_COCOA_ENTER(env);
// My helper Obj-c object to make a selector call
OpenFileObject *openFile = [[OpenFileObject alloc] init];
if ([NSThread isMainThread])
[openFile showOpenFileDialog];
else
[JNFRunLoop performOnMainThread:@selector(showOpenFileDialog) on:openFile withObject:nullptr waitUntilDone:TRUE];
// ...Handles results
JNF_COCOA_EXIT(env);
这里是showOpenFileDialog
方法:
NSOpenPanel *panel = [NSOpenPanel openPanel];
[panel setCanChooseFiles:canChooseFiles];
[panel setCanChooseDirectories:canChooseFolders];
[panel setAllowsMultipleSelection:allowMultiSelection];
[panel setAllowedFileTypes:fileTypes];
[panel setTitle:dialogTitle];
if ([panel runModal] == NSFileHandlingPanelOKButton)
urls = [[panel URLs] copy];
else
urls = nullptr;
,这里是挂起报告:https://gist.github.com/4207956
任何想法?
可能是不相关的,但由于缓冲区溢出,我确实在类似的堆栈中发现了这样的崩溃:http://www.cocoabuilder.com/archive/cocoa/130423-nssavepanel-crashing-on-instantiation.html – lyricsboy