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

Crash occurs when GUI thread accesses QRhi objects created by Renderer Thread

    XMLWordPrintable

Details

    • Linux/X11
    • 0ac01b27ef (qt/qtdeclarative/6.4) 5b24e324d3 (qt/qtdeclarative/dev) 5b24e324d3 (qt/qtdeclarative/wip/material3) 0ac01b27ef (qt/tqtc-qtdeclarative/6.4) 5b24e324d3 (qt/tqtc-qtdeclarative/dev)

    Description

      1) preset in QQuickWindow

       : setPersistentGraphics(false)
       : setPersistentSceneGraph(false)

      2) Crash sequence

      1. Load Shape Component on Window is unvisible(visible: false)
      2. Change Window visible to true 
      3. Crash

       

      See this crash reproduce code.

      (Run -> window hide after 2sec -> show and crash after 2sec)

      //main.cpp 
      #include <QGuiApplication>
      #include <QQmlApplicationEngine>
      #include <QQuickWindow>
      
      int main(int argc, char *argv[])
      {
          QGuiApplication app(argc, argv);
      
          QQmlApplicationEngine engine;
          const QUrl url(u"qrc:/QtTest/main.qml"_qs);
          QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
                           &app, [url](QObject *obj, const QUrl &objUrl) {
              if (!obj && url == objUrl)
                  QCoreApplication::exit(-1);
          }, Qt::QueuedConnection);
          engine.load(url);
      
          QObject *root = engine.rootObjects()[0];
          QQuickWindow *window = qobject_cast<QQuickWindow *>(root);
          window->setPersistentGraphics(false);
          window->setPersistentSceneGraph(false);
      
          return app.exec();
      }
      
      //main.qml
      import QtQuick
      import QtQuick.Window
      import QtQuick.Shapes
      
      Window {
          id: window
          visible: true
          width: 1920
          height: 720-106
      
          Loader {
              id: crashLoader
              anchors.fill: parent
              sourceComponent: crash
              active: false
              onActiveChanged: {
                  console.log("crashLoader active is " + active)
              }
          }
      
          Timer {
              interval: 2000
              repeat: true
              running: true
              onTriggered: {
                  window.visible = !window.visible
      
              }
          }
          onVisibleChanged: {
              if(!visible) {
                  crashLoader.active = true
              }
          }
      
          Component {
              id: crash
              Shape {
                  width: 120
                  height: 130
                  anchors.bottom: parent.bottom
                  anchors.right: parent.right
                  layer.enabled: true
                  layer.samples: 4
      
                  ShapePath {
                      fillColor: "black"
                      strokeColor: "darkBlue"
                      strokeWidth: 20
                      capStyle: ShapePath.FlatCap
      
                      PathAngleArc {
                          centerX: 65; centerY: 95
                          radiusX: 45; radiusY: 45
                          startAngle: -180
                          sweepAngle: 180
      
                          Component.onCompleted: {
                              console.log("created PathAngleArc")
                          }
                      }
      
                      Component.onCompleted: {
                          console.log("created ShapePath")
                      }
                  }
      
                  Component.onCompleted: {
                      console.log("created Shape")
                  }
              }
          }
      }
      

      Attachments

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

        Activity

          People

            janichol Andy Nichols
            bumjoon.park BUMJOON PARK (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes