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

SEGFAULT Crash in QQmlAnimationTimer::registerAnimation

XMLWordPrintable

    • Linux/X11
    • 9c732286ed72afe8cc2d2062e6cedbe5f6a06447 (qt/qtdeclarative/dev) ae9279b3145183f5b4815d85d8488c53846de707 (qt/qtdeclarative/6.2) 36a7259405aae9ce1ea474e28029e42db7d589fc (qt/qtdeclarative/6.2.2)

       

      // main.cpp
      
      #include <QGuiApplication>
      #include <QQmlApplicationEngine>
      #include <QQuickWindow>
      
      int main(int argc, char *argv[])
      {
          qputenv("QSG_RENDER_LOOP", QByteArrayLiteral("threaded"));
      #if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
          QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
      #endif
      
          QGuiApplication app(argc, argv);
      
          QQmlApplicationEngine engine;
          const QUrl url(QStringLiteral("qrc:/main.qml"));
          QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
                           &app, [url](QObject *obj, const QUrl &objUrl) {
              if (!obj && url == objUrl)
                  QCoreApplication::exit(-1);
          }, Qt::QueuedConnection);
          engine.load(url);
      
          QQuickWindow *w = qobject_cast<QQuickWindow *>(engine.rootObjects()[0]);
          //###########################################
      #if QT_VERSION > QT_VERSION_CHECK(6, 0, 0)
          w->setPersistentGraphics(false);
      #else 
          w->setPersistentOpenGLContext(false); 
      #endif
          w->setPersistentSceneGraph(false);
          //###########################################
          return app.exec();
      }
      
      //main.qml
      
      import QtQuick 2.12
      import QtQuick.Window 2.12
      
      Window {
          id: root
          width: 640
          height: 480
          visible: true
          title: qsTr("Hello World")
      
          Rectangle {
              id: rect
              anchors.fill: parent
              color: "red"
      
              Component.onCompleted: anim.start()
          }
      
          OpacityAnimator {
              id: anim
      
              target: rect
              from: 1
              to: 0
              duration: 20000
          }
      
          MouseArea {
              anchors.fill: parent
      
              onPressed: {
                  root.hide()
                  timer.start()
              }
          }
      
          Timer {
              id: timer
              interval: 2000
              onTriggered: {
                  root.show()
              }
      
          }
      }
      
      • Condition
        • set PersistentOpenGlContext to false in cpp
        • set PersistentSceneGraph to false in cpp
      • Scenario
        • During animation by Animator, hide animation target and show it.
        • In example code
          • Clicked the MouseArea -> Hide window -> after 2sec, window should be shown , but crashed

       

      In hide time, m_timer was destroyed in QAbstractAnimationJob Class and

      In show time, QAbstractAnimationJob pointed the dangling pointers that m_timer and crashed

       

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

            vhilshei Volker Hilsheimer
            bumjoon.park BUMJOON PARK (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: