我有一個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