私はSwing
アプリを持っていてJNI
、NSOpenPanel
. 一部のコンピューターでは (残念ながら類似点は見つかりませんでした)、アプリが完全にハングします。ほとんどのコンピュータでは正しく動作します。コードが特定の Mac でアプリをハングさせる場合、アプリが実行されるたびにハングします。
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
何か案は?