diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-09-02 16:36:37 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-09-02 16:36:37 (GMT) |
commit | 84df4fc9dc922bb29e3c432b215275b30b6cffd0 (patch) | |
tree | 7bde645bbebb5c798008c9572e4d6c54b34e4b64 /src/opengl/qgl_mac.mm | |
parent | 2282a77f4e4be2fef4b78a3557cb88fb86cdcf34 (diff) | |
parent | 4b7346a4bd30705ab5910d448ec56daa6568aa90 (diff) | |
download | Qt-84df4fc9dc922bb29e3c432b215275b30b6cffd0.zip Qt-84df4fc9dc922bb29e3c432b215275b30b6cffd0.tar.gz Qt-84df4fc9dc922bb29e3c432b215275b30b6cffd0.tar.bz2 |
Merge branch '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1 into 4.7-integration
* '4.7' of scm.dev.nokia.troll.no:qt/oslo-staging-1:
Fix remote crash in delivering D-Bus calls with too few arguments
Ensure that OpenGL contexts are attached to an NSView before first paint
Reduce memory consumption of QtScript/JSC on Symbian
Doc: Changed the default URL to avoid a Flash plugin crash on x86-64.
Doc: Updated Supported Platforms page. Finished
New binary of configure.exe with -mp/-no-mp option
Turn Makefile.win32 into batch-mode, enable /MP and PCH
Add option to enable -MP compile option for MSVC
Rewrite ucstrcmp in terms of ucstrncmp
Reorganise qelapsedtimer_unix.cpp for better inlining performance.
Update the cpuid code to be better
Revert "Restore default if to system default on session close."
Diffstat (limited to 'src/opengl/qgl_mac.mm')
-rw-r--r-- | src/opengl/qgl_mac.mm | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/opengl/qgl_mac.mm b/src/opengl/qgl_mac.mm index 66fe7d3..f023a97 100644 --- a/src/opengl/qgl_mac.mm +++ b/src/opengl/qgl_mac.mm @@ -697,9 +697,17 @@ void QGLContext::updatePaintDevice() QWidget *w = (QWidget *)d->paintDevice; NSView *view = qt_mac_nativeview_for(w); - // ideally we would use QWidget::isVisible(), but we get "invalid drawable" errors - if (![(NSWindow *)qt_mac_window_for(w) isVisible]) - return; + // Trying to attach the GL context to the NSView will fail with + // "invalid drawable" if done too soon, but we have to make sure + // the connection is made before the first paint event. Using + // the NSView do to this check fails as the NSView is visible + // before it's safe to connect, and using the NSWindow fails as + // the NSWindow will become visible after the first paint event. + // This leaves us with the QWidget, who's visible state seems + // to match the point in time when it's safe to connect. + if (!w || !w->isVisible()) + return; // Not safe to attach GL context to view yet + if ([static_cast<NSOpenGLContext *>(d->cx) view] != view && ![view isHidden]) [static_cast<NSOpenGLContext *>(d->cx) setView:view]; } else if (d->paintDevice->devType() == QInternal::Pixmap) { |