* use autoReleasePool as per example: https://gist.github.com/shannah/65007754c2b0f8add4f7
This commit is contained in:
parent
2f61d6c858
commit
0474d73c97
|
@ -20,6 +20,8 @@ import javax.swing.UIManager;
|
|||
import ca.weblite.objc.Client;
|
||||
import ca.weblite.objc.Proxy;
|
||||
|
||||
import com.sun.jna.Pointer;
|
||||
|
||||
public class MacAppUtilities {
|
||||
|
||||
private static Client _objc;
|
||||
|
@ -52,9 +54,11 @@ public class MacAppUtilities {
|
|||
// WARNING: dispatch_sync seems to work on most Mac always causes a deadlock and freezes the application on others (in particular MBP with 2 graphics chips)
|
||||
dispatch_async(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
Pointer pool = createAutoreleasePool();
|
||||
Proxy peer = objc().sendProxy("NSOpenPanel", "openPanel");
|
||||
peer.send("retain");
|
||||
|
||||
peer.send("setTitle:", title);
|
||||
peer.send("setAllowsMultipleSelection:", multipleMode ? 1 : 0);
|
||||
peer.send("setCanChooseDirectories:", canChooseDirectories ? 1 : 0);
|
||||
|
@ -78,6 +82,7 @@ public class MacAppUtilities {
|
|||
}
|
||||
}
|
||||
|
||||
drainAutoreleasePool(pool);
|
||||
secondaryLoop.exit();
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue