From 04707d3c1c628d6bf493d6916621d5e34dfefc30 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 23 Dec 2011 04:57:41 +0100 Subject: NEWT/OSX MacWindow.close(): More conservative closing approach. Closing: - Java: Set handle to null - Native: - Don't release the NSView explicit, but rely on NSWindow's release - Don't use NSWindow close() but simply call release() instead. The latter doesn't produce a crash SIGSEGV on exit in some cases. OSX 10.7.2, NV GPU --- src/newt/native/MacWindow.m | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'src/newt/native') diff --git a/src/newt/native/MacWindow.m b/src/newt/native/MacWindow.m index 5bd0707d4..ddd59f0a1 100644 --- a/src/newt/native/MacWindow.m +++ b/src/newt/native/MacWindow.m @@ -651,8 +651,9 @@ NS_DURING if([mView isInFullScreenMode]) { [mView exitFullScreenModeWithOptions: NULL]; } - [mWin setContentView: nil]; - [mView release]; + // Note: mWin's release will also release it's mView! + // [mWin setContentView: nil]; + // [mView release]; } NS_HANDLER NS_ENDHANDLER @@ -665,7 +666,11 @@ NS_ENDHANDLER DBG_PRINT( "windowClose.1 - %p,%d view %p,%d, parent %p\n", mWin, getRetainCount(mWin), mView, getRetainCount(mView), pWin); - [mWin close]; // performs release! + // '[mWin close]' causes a crash at exit. + // This probably happens b/c it sends events to the main loop + // but our resources are gone ?! + // However, issuing a simple release seems to work quite well. + [mWin release]; DBG_PRINT( "windowClose.X - %p,%d view %p,%d, parent %p\n", mWin, getRetainCount(mWin), mView, getRetainCount(mView), pWin); -- cgit v1.2.3