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

UniformAnimator crashes if the animated ShaderEffect is destroyed

    XMLWordPrintable

Details

    • WebAssembly

    Description

      Had press effect in Qt Quick Controls dialog that uses UniformAnimator. The dialog is destroyed after closed. The dialog was sometimes closed before the press effect had time to complete. This causes UniformAnimator to crash with the browser reporting "Uncaught RuntimeError: memory access out of bounds". AFAICS the issue only reproduces on the WebAssembly builds.

      Update: Could also reproduce on low-end ARM Linux embedded device, though not on my Linux laptop.

      Here is a simplified example:

      Timer {
          interval: 100
          repeat: true; running: true
          onTriggered: effect.createObject(parent)
      }
      Component {
          id: effect
          ShaderEffect {
              property real progress
              Component.onDestruction: console.log("Destroyed")
              UniformAnimator on progress {
                  uniform: "progress"
                  from: 0.0; to: 1.0
                  duration: 400
              }
              Timer {
                  interval: 100
                  running: true
                  onTriggered: parent.destroy()
              }
          }
      }

      The example is oversimplified, reproduces also in real-world scenarios with .qsb shaders and non-zero item dimensions defined.

      The stack trace of the crash:

          at memcmp (---.wasm:0x1dd93e8)
          at QQuickShaderEffectPrivate::findMappedShaderVariableId(:6931/QByteArray const&) const (http://localhost:6931/---.wasm)
          at QQuickShaderEffectPrivate::updateUniformValue(:6931/QByteArray const&, QVariant const&, QSGShaderEffectNode*) (http://localhost:6931/---.wasm)
          at QQuickShaderEffect::updateUniformValue(:6931/QByteArray const&, QVariant const&) (http://localhost:6931/---.wasm)
          at QQuickUniformAnimatorJob::updateCurrentTime(:6931/int) (http://localhost:6931/---.wasm)
          at QAbstractAnimationJob::setCurrentTime(:6931/int) (http://localhost:6931/---.wasm)
          at QParallelAnimationGroupJob::updateCurrentTime(:6931/int) (http://localhost:6931/---.wasm)
          at QAbstractAnimationJob::setCurrentTime(:6931/int) (http://localhost:6931/---.wasm)
          at QQmlAnimationTimer::updateAnimationsTime(:6931/long long) (http://localhost:6931/---.wasm)
          at QUnifiedTimer::updateAnimationTimers(:6931/) (http://localhost:6931/---.wasm)

       

       

      Attachments

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

        Activity

          People

            qt.webassembly qt.webassembly
            jpetrell Joona Petrell
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes