Make cocoa opengl backend threadsafe.

The current implementation on Mac OS X called update() inside
the cocoa plugin from the GUI thread, which breaks when trying
to use the GL context from another thread and the window gets
resized. We now only call it from makeCurrent()

Change-Id: I025aad3a3b140e85e729816bf3b68827337cc80d
Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
This commit is contained in:
Gunnar Sletta 2011-11-24 16:38:40 +01:00 committed by Qt by Nokia
parent e08410ab8d
commit 7dabd65ff6
2 changed files with 1 additions and 9 deletions

View File

@ -86,6 +86,7 @@ bool QCocoaGLContext::makeCurrent(QPlatformSurface *surface)
setActiveWindow(window);
[m_context makeCurrentContext];
update();
return true;
}

View File

@ -125,9 +125,6 @@ void QCocoaWindow::setGeometry(const QRect &rect)
[[m_nsWindow contentView] setFrameSize:bounds.size];
[m_nsWindow setContentSize : bounds.size];
[m_nsWindow setFrameOrigin : bounds.origin];
if (m_glContext)
m_glContext->update();
}
void QCocoaWindow::setVisible(bool visible)
@ -215,9 +212,6 @@ NSView *QCocoaWindow::contentView() const
void QCocoaWindow::windowDidMove()
{
if (m_glContext)
m_glContext->update();
NSRect rect = [[m_nsWindow contentView]frame];
NSRect windowRect = [m_nsWindow frame];
@ -228,9 +222,6 @@ void QCocoaWindow::windowDidMove()
void QCocoaWindow::windowDidResize()
{
if (m_glContext)
m_glContext->update();
NSRect rect = [[m_nsWindow contentView]frame];
NSRect windowRect = [m_nsWindow frame];