diff --git a/include/osgViewer/api/Cocoa/GraphicsWindowCocoa b/include/osgViewer/api/Cocoa/GraphicsWindowCocoa index fd11ef64a..e122624b4 100755 --- a/include/osgViewer/api/Cocoa/GraphicsWindowCocoa +++ b/include/osgViewer/api/Cocoa/GraphicsWindowCocoa @@ -183,11 +183,12 @@ class GraphicsWindowCocoa : public osgViewer::GraphicsWindow private: - bool _closeRequested, _checkForEvents,_ownsWindow; - MouseCursor _currentCursor; - GraphicsWindowCocoaWindow* _window; - GraphicsWindowCocoaGLView* _view; - NSOpenGLContext* _context; + bool _closeRequested, _checkForEvents,_ownsWindow; + MouseCursor _currentCursor; + GraphicsWindowCocoaWindow* _window; + GraphicsWindowCocoaGLView* _view; + NSOpenGLContext* _context; + bool _updateContext; }; } diff --git a/src/osgViewer/GraphicsWindowCocoa.mm b/src/osgViewer/GraphicsWindowCocoa.mm index b9b46589c..c90b23750 100755 --- a/src/osgViewer/GraphicsWindowCocoa.mm +++ b/src/osgViewer/GraphicsWindowCocoa.mm @@ -857,6 +857,7 @@ void GraphicsWindowCocoa::init() _ownsWindow = false; _context = NULL; _window = NULL; + _updateContext = false; _valid = _initialized = true; } @@ -1065,6 +1066,12 @@ void GraphicsWindowCocoa::closeImplementation() bool GraphicsWindowCocoa:: makeCurrentImplementation() { + if (_updateContext) + { + [_context update]; + _updateContext = false; + } + [_context makeCurrentContext]; return true; } @@ -1205,13 +1212,10 @@ void GraphicsWindowCocoa::resizedImplementation(int x, int y, int width, int hei DEBUG_OUT("resized implementation" << x << " " << y << " " << width << " " << height); GraphicsContext::resizedImplementation(x, y, width, height); - NSAutoreleasePool* localPool = [[NSAutoreleasePool alloc] init]; - - if (_context) - [_context update]; + _updateContext = true; + MenubarController::instance()->update(); getEventQueue()->windowResize(x,y,width, height, getEventQueue()->getTime()); - [localPool release]; }