Skip to content

Commit

Permalink
From Stephan Huber, "attached you'll find a fix for the dead locks wh…
Browse files Browse the repository at this point in the history
…en closing a window

under OS X."
  • Loading branch information
robertosfield committed Jul 27, 2007
1 parent c689bb2 commit 3ffd74b
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/osgViewer/GraphicsWindowCarbon.cpp
Expand Up @@ -33,7 +33,6 @@ static pascal OSStatus GraphicsWindowEventHandler(EventHandlerCallRef nextHandle
OSStatus result = eventNotHandledErr; /* report failure by default */


result = CallNextEventHandler (nextHandler, event);

GraphicsWindowCarbon* w = (GraphicsWindowCarbon*)userData;
if (!w)
Expand Down Expand Up @@ -77,8 +76,9 @@ static pascal OSStatus GraphicsWindowEventHandler(EventHandlerCallRef nextHandle
result = noErr;
break;

case kEventWindowClosed:
case kEventWindowClose:
w->requestClose();
result = noErr;
break;

default:
Expand All @@ -88,6 +88,10 @@ static pascal OSStatus GraphicsWindowEventHandler(EventHandlerCallRef nextHandle
default:
break;
}

if (result == eventNotHandledErr)
result = CallNextEventHandler (nextHandler, event);

return result;
}

Expand Down Expand Up @@ -570,7 +574,7 @@ void GraphicsWindowCarbon::installEventHandler() {
// register window event handler to receive resize-events
EventTypeSpec windEventList[] = {
{ kEventClassWindow, kEventWindowBoundsChanged},
{ kEventClassWindow, kEventWindowClosed},
{ kEventClassWindow, kEventWindowClose},

{kEventClassMouse, kEventMouseDown},
{kEventClassMouse, kEventMouseUp},
Expand Down Expand Up @@ -730,6 +734,7 @@ bool GraphicsWindowCarbon::releaseContextImplementation()

void GraphicsWindowCarbon::closeImplementation()
{
// osg::notify(osg::INFO) << "GraphicsWindowCarbon::closeImplementation" << std::endl;
_valid = false;
_realized = false;

Expand Down Expand Up @@ -1090,7 +1095,7 @@ void GraphicsWindowCarbon::checkEvents()
ReleaseEvent(theEvent);
}
if (_closeRequested)
close(true);
getEventQueue()->closeWindow();

if (s_quit_requested) {
getEventQueue()->quitApplication();
Expand Down

0 comments on commit 3ffd74b

Please sign in to comment.