summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-05-02 03:28:29 +0200
committerSven Gothel <[email protected]>2012-05-02 03:28:29 +0200
commit9ff0b0dafea2a03a915c97eb1513c39c27b6a7ae (patch)
tree1668ccdf0604b8e247e8b5ed26842a7f7b5fc5b3 /src
parent6710acebee541a843a6f546300bea885e437b986 (diff)
NEWT/OSX: Fix occasional crash 'free of non allocated object' - change window order on main-thread.v2.0-rc8
Diffstat (limited to 'src')
-rw-r--r--src/newt/native/MacWindow.m25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/newt/native/MacWindow.m b/src/newt/native/MacWindow.m
index 64871f11d..01cbd80ec 100644
--- a/src/newt/native/MacWindow.m
+++ b/src/newt/native/MacWindow.m
@@ -806,10 +806,11 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_MacWindow_requestFocus0
DBG_PRINT( "requestFocus - window: %p, force %d, hasFocus %d (START)\n", mWin, force, hasFocus);
[mWin makeFirstResponder: nil];
- // [mWin performSelectorOnMainThread:@selector(orderFrontRegardless) withObject:nil waitUntilDone:YES];
- // [mWin performSelectorOnMainThread:@selector(makeKeyWindow) withObject:nil waitUntilDone:YES];
- [mWin orderFrontRegardless];
- [mWin makeKeyWindow];
+ [mWin performSelectorOnMainThread:@selector(orderFrontRegardless) withObject:nil waitUntilDone:YES];
+ [mWin performSelectorOnMainThread:@selector(makeKeyWindow) withObject:nil waitUntilDone:YES];
+ // This will occasionally cause a free of non allocated object crash:
+ // [mWin orderFrontRegardless];
+ // [mWin makeKeyWindow];
DBG_PRINT( "requestFocus - window: %p, force %d (END)\n", mWin, force);
@@ -833,7 +834,9 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_MacWindow_requestFocusPare
DBG_PRINT( "requestFocusParent0 - window: %p, parent: %p, hasFocus %d (START)\n", mWin, pWin, hasFocus );
if(NULL != pWin) {
- [pWin makeKeyWindow];
+ [pWin performSelectorOnMainThread:@selector(makeKeyWindow) withObject:nil waitUntilDone:YES];
+ // This will occasionally cause a free of non allocated object crash:
+ // [pWin makeKeyWindow];
}
DBG_PRINT( "requestFocusParent0 - window: %p, parent: %p (END)\n", mWin, pWin);
@@ -853,7 +856,9 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_MacWindow_orderFront0
DBG_PRINT( "orderFront0 - window: %p (START)\n", win);
- [win orderFrontRegardless];
+ [win performSelectorOnMainThread:@selector(orderFrontRegardless) withObject:nil waitUntilDone:YES];
+ // This will occasionally cause a free of non allocated object crash:
+ // [win orderFrontRegardless];
DBG_PRINT( "orderFront0 - window: %p (END)\n", win);
@@ -875,9 +880,13 @@ JNIEXPORT void JNICALL Java_jogamp_newt_driver_macosx_MacWindow_orderOut0
DBG_PRINT( "orderOut0 - window: (parent %p) %p (START)\n", pWin, mWin);
if(NULL == pWin) {
- [mWin orderOut: mWin];
+ [mWin performSelectorOnMainThread:@selector(orderOut:) withObject:mWin waitUntilDone:YES];
+ // This will occasionally cause a free of non allocated object crash:
+ // [mWin orderOut: mWin];
} else {
- [mWin orderBack: mWin];
+ [mWin performSelectorOnMainThread:@selector(orderBack:) withObject:mWin waitUntilDone:YES];
+ // This will occasionally cause a free of non allocated object crash:
+ // [mWin orderBack: mWin];
}
DBG_PRINT( "orderOut0 - window: (parent %p) %p (END)\n", pWin, mWin);