summaryrefslogtreecommitdiffstats
path: root/src/opengl
diff options
context:
space:
mode:
authorMichael Brasser <michael.brasser@nokia.com>2009-05-20 05:13:28 (GMT)
committerMichael Brasser <michael.brasser@nokia.com>2009-05-20 05:13:28 (GMT)
commite4d41f8090838359ae0deb1af410e8a501a6a9b6 (patch)
tree00720f39c15826018ba6cf0aae58e1ac3089cffb /src/opengl
parentd1f1f2c91f63609ca1ffad32efdd6590f9f0ce6a (diff)
downloadQt-e4d41f8090838359ae0deb1af410e8a501a6a9b6.zip
Qt-e4d41f8090838359ae0deb1af410e8a501a6a9b6.tar.gz
Qt-e4d41f8090838359ae0deb1af410e8a501a6a9b6.tar.bz2
Fix possible X11/EGL crash.
Changed-by: Rhys Weatherley Reviewed-by: Tom Cooksey
Diffstat (limited to 'src/opengl')
-rw-r--r--src/opengl/qgl_x11egl.cpp14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/opengl/qgl_x11egl.cpp b/src/opengl/qgl_x11egl.cpp
index 480a2dc..f8ea8de 100644
--- a/src/opengl/qgl_x11egl.cpp
+++ b/src/opengl/qgl_x11egl.cpp
@@ -268,10 +268,16 @@ void QGLWidget::setContext(QGLContext *context, const QGLContext* shareContext,
XVisualInfo vi;
- int err = XMatchVisualInfo(x11Info().display(), x11Info().screen(), x11Info().depth(), TrueColor, &vi);
- if (err == 0) {
- qWarning("Error: Couldn't get a matching X visual for format");
- return;
+ if (parentWidget()) {
+ vi.depth = parentWidget()->x11Info().depth();
+ vi.screen = parentWidget()->x11Info().screen();
+ vi.visual = (Visual *)(parentWidget()->x11Info().visual());
+ } else {
+ int err = XMatchVisualInfo(x11Info().display(), x11Info().screen(), x11Info().depth(), TrueColor, &vi);
+ if (err == 0) {
+ qWarning("Error: Couldn't get a matching X visual for format");
+ return;
+ }
}
XSetWindowAttributes a;