Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-38393

All Qt3d QML examples deployed on Android that use textures crash on exit

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P3: Somewhat important
    • None
    • 5.3.0 Beta1
    • Qt3D
    • None
    • Qt 5.3.0 beta1 for Android on Windows 7 (qt-opensource-windows-x86-android-5.3.0-beta)
    • Android

    Description

      Any Qt3d QML examples deployed on Android that use textures will crash on exit in QGLTexture2D::TobeDeletedLater() when the OpenGLContext argument passed in is accessed.

      As textures are widely used in shaderprogram and materials this affects many of the eamples and demos provided.

      This is because as cleanup starts after the Quit() slot is called the OpenGL context is not in the same execution thread.

      A warning as shown is seen followed by many repetitions of cleanupResources() warnings each one matching any textures used. Finally the crash comes when the context is deleted after it has already been freed.

      E/libEGL (17836): call to OpenGL ES API with no current context (logged once per thread)
      QGLTexture2DPrivate::cleanupResources()): cleanupResources() was called from wrong context. Some OpenGL resources are not released.

      This issue was not seen in previous Qt releases of 5.2.x and is now seen on OpenGL ES 2 & 3 implementations alike. I have tried Adreno and Tegra.

      I have been able to avoid this in all cases I have tried by adding the following hack to the destructor, but this essentially seems to prevent the context cleanup intended in mournGLContextDeath when I checked with a breakpoint:

      QGLTexture2DPrivate::~QGLTexture2DPrivate()
      {
      if (!textureInfo.empty()) {
      QOpenGLContext *ctx = QOpenGLContext::currentContext();
      for (QList<QGLTexture2DTextureInfo*>::iterator It=textureInfo.begin(); It!=textureInfo.end(); ++It) {
      if ((*It)>isLiteral==false && (*It)>tex.textureId()) {
      #if defined(QT_OPENGL_ES)
      if (ctx)

      { QOpenGLContext *ictx = const_cast<QOpenGLContext*>((*It)->tex.context()); Q_ASSERT(ictx!=0); if (!QOpenGLContext::areSharing(ictx, ctx)) QGLTexture2D::toBeDeletedLater(ictx, (*It)->tex.textureId()); }

      #else
      QGLTexture2D::toBeDeletedLater(ictx, (*It)->tex.textureId());
      #endif
      }
      }
      }
      qDeleteAll(textureInfo);
      }

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            seanharmer Sean Harmer
            davered David Robinson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes