summaryrefslogtreecommitdiffstats
path: root/src/opengl/qgl_mac.mm
diff options
context:
space:
mode:
authorQt Continuous Integration System <qt-info@nokia.com>2010-09-06 02:50:24 (GMT)
committerQt Continuous Integration System <qt-info@nokia.com>2010-09-06 02:50:24 (GMT)
commit91b1eff723c47fbe12d406a27053eea7d6c4a812 (patch)
tree84f4e93a18db2f72ea089df9f8eccc549f9a4206 /src/opengl/qgl_mac.mm
parentb9fb38de38f364a4c51d301c8e3d2dbdb90399e6 (diff)
parent45cbfc6871da8582d13888b5808317cd3b7753c8 (diff)
downloadQt-91b1eff723c47fbe12d406a27053eea7d6c4a812.zip
Qt-91b1eff723c47fbe12d406a27053eea7d6c4a812.tar.gz
Qt-91b1eff723c47fbe12d406a27053eea7d6c4a812.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: (25 commits) Recognize @, #, $ and ` as word separators rebuild configure.exe Fix dependencies so JOM will handle parallellization properly Symbian: Disable IPv6 for now Doc: Fixed namespaced Qt build breakage in the model/view tutorial. Doc: Fixing links on index page and corecting HTML in the template. Accept empty authority segments in QUrl as different from not-present Doc: Adds line about non-support for Webkit on Solaris protect nil dictionary from release. Fix potential KERN-EXEC 0 on Symbian. Ukrainian translation updated Fix remote crash in delivering D-Bus calls with too few arguments Ensure that OpenGL contexts are attached to an NSView before first paint Doc: Updating the 3rd party lib used in Qt - including JQuery Doc: Changed the default URL to avoid a Flash plugin crash on x86-64. Reduce memory consumption of QtScript/JSC on Symbian 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 ...
Diffstat (limited to 'src/opengl/qgl_mac.mm')
-rw-r--r--src/opengl/qgl_mac.mm14
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) {