From Stephan Huber, "ttached you'll find a small fix for the

GraphicsWindowCocoa-implementation, which enhances multithreaded
stability, it ensures that modifications to the size of an openglcontext
is done only from one thread.
"
This commit is contained in:
Robert Osfield
2009-07-13 08:30:20 +00:00
parent 554a6da56d
commit c47c0c2a26
2 changed files with 15 additions and 10 deletions

View File

@@ -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;
};
}

View File

@@ -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];
}