diff options
author | Chris Meyer <cmeyer1969@gmail.com> | 2013-09-09 14:00:18 -0700 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-09-10 16:14:33 +0200 |
commit | 04325bdd26810cd9067ad4b0b9e458b06ce2a3db (patch) | |
tree | dea48699f396bbb3e6860fa4d048bf0f3aa8b738 /src/plugins/platforms/cocoa/qnsview.mm | |
parent | c9c435179eddd4f252658b1106b924441168ca56 (diff) |
Fix Invalid Drawable error when using createWindowContainer on Mac.
You are not supposed to call NSOpenGLContext -setView: for a view that
has not yet called drawRect. Doing this would result in a invalid
drawable error.
Similar to 4.8 commit cd2a51a66f52767c20e80361033c573651b3a08d
Change-Id: Ibb2300a8c6fe52f786f813987e93d4a3dc145366
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src/plugins/platforms/cocoa/qnsview.mm')
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index c2ffe96f8c..9fc74ea72b 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -87,6 +87,7 @@ static QTouchDevice *touchDevice = 0; m_sendKeyEvent = false; m_subscribesForGlobalFrameNotifications = false; m_glContext = 0; + m_drawRectHasBeenCalled = false; m_shouldSetGLContextinDrawRect = false; currentCustomDragTypes = 0; m_sendUpAsRightButton = false; @@ -153,9 +154,9 @@ static QTouchDevice *touchDevice = 0; - (void) setQCocoaGLContext:(QCocoaGLContext *)context { m_glContext = context; - [m_glContext->nsOpenGLContext() setView:self]; - if (![m_glContext->nsOpenGLContext() view]) { - //was unable to set view + if (m_drawRectHasBeenCalled) { + [m_glContext->nsOpenGLContext() setView:self]; + } else { m_shouldSetGLContextinDrawRect = true; } @@ -392,6 +393,8 @@ static QTouchDevice *touchDevice = 0; m_shouldSetGLContextinDrawRect = false; } + m_drawRectHasBeenCalled = true; + if (!m_backingStore) return; |