src/opengl/qgl_egl.cpp
changeset 37 758a864f9613
parent 33 3e2da88830cd
equal deleted inserted replaced
36:ef0373b55136 37:758a864f9613
   228 }
   228 }
   229 
   229 
   230 void QGLContextPrivate::destroyEglSurfaceForDevice()
   230 void QGLContextPrivate::destroyEglSurfaceForDevice()
   231 {
   231 {
   232     if (eglSurface != EGL_NO_SURFACE) {
   232     if (eglSurface != EGL_NO_SURFACE) {
   233 #ifdef Q_WS_X11
   233 #if defined(Q_WS_X11) || defined(Q_OS_SYMBIAN)
   234         // Make sure we don't call eglDestroySurface on a surface which
   234         // Make sure we don't call eglDestroySurface on a surface which
   235         // was created for a different winId. This applies only to QGLWidget
   235         // was created for a different winId. This applies only to QGLWidget
   236         // paint device, so make sure this is the one we're operating on
   236         // paint device, so make sure this is the one we're operating on
   237         // (as opposed to a QGLWindowSurface use case).
   237         // (as opposed to a QGLWindowSurface use case).
   238         if (paintDevice && paintDevice->devType() == QInternal::Widget) {
   238         if (paintDevice && paintDevice->devType() == QInternal::Widget) {
   239             QWidget *w = static_cast<QWidget *>(paintDevice);
   239             QWidget *w = static_cast<QWidget *>(paintDevice);
   240             if (QGLWidget *wgl = qobject_cast<QGLWidget *>(w)) {
   240             if (QGLWidget *wgl = qobject_cast<QGLWidget *>(w)) {
   241                 if (wgl->d_func()->eglSurfaceWindowId != wgl->winId()) {
   241                 if (wgl->d_func()->eglSurfaceWindowId != wgl->winId()) {
   242                     qWarning("WARNING: Potential EGL surface leak! Not destroying surface.");
   242                     qWarning("WARNING: Potential EGL surface leak! Not destroying surface.");
       
   243                     eglSurface = EGL_NO_SURFACE;
   243                     return;
   244                     return;
   244                 }
   245                 }
   245             }
   246             }
   246         }
   247         }
   247 #endif
   248 #endif