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

Changing activeFrameGraph segfaults

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • None
    • 5.7.0
    • Qt3D
    • None
    • Ubuntu 16.04, Nvidia, Qt 5.7.0
    •  335246d0b6cf0498bf26a48b296ad44fab566c8f

    Description

      Changing the activeFrameGraph property in RenderSettings causes the application to crash. The crash appears to happen in RenderSettings::sceneChangeEvent where the line

      m_activeFrameGraph = propertyChange->value().value<QNodePtr>()->id();

      segfaults because the QNodeId holds a null pointer. I would be happy to investigate this further, but I was unable to figure out where this event is coming from and why the id is invalid.

      I have attached an example project that illustrates this problem. When the switch in the upper left corner is pressed, the application crashes. The main.qml looks as follows:

      import QtQuick 2.5
      import QtQuick.Controls 1.4
      import QtQuick.Window 2.2
      import QtQuick.Scene3D 2.0
      import Qt3D.Core 2.0
      import Qt3D.Extras 2.0
      import Qt3D.Logic 2.0
      import Qt3D.Input 2.0
      import Qt3D.Render 2.0
      
      ApplicationWindow {
          id: root
      
          visible: true
          width: 640
          height: 480
          title: qsTr("Hello World")
      
          Scene3D {
              anchors.fill: parent
              aspects: ["render", "input", "logic"]
              Entity {
                  components: [
                      RenderSettings {
                          activeFrameGraph: switchBox.checked ? graph1 : graph2
                      },
                      InputSettings {
                          id: inputSettings
                      }
                  ]
      
                  ForwardRenderer {
                      id: graph1
                      camera: Camera {
                          aspectRatio: root.width / root.height
                          position: Qt.vector3d(7.0, 7.0, 7.0)
                          viewCenter: Qt.vector3d(0, 0, 0)
                      }
                  }
      
                  ForwardRenderer {
                      id: graph2
                      camera: Camera {
                          aspectRatio: root.width / root.height
                          position: Qt.vector3d(3.0, -7.0, 2.0)
                          viewCenter: Qt.vector3d(0, 0, 0)
                      }
                  }
      
                  Entity {
                      components: [
                          CuboidMesh {},
                          PhongMaterial{}
                      ]
                  }
              }
          }
      
          Switch {
              id: switchBox
          }
      }
      

      The following quote in the documentation indicates that the above example should work: "Of course, since this is a QML property binding, the active framegraph (or parts of it) can be changed on the fly at runtime." from https://doc.qt.io/qt-5/qt3drender-framegraph.html

      Attachments

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

        Activity

          People

            lemire_p Paul Lemire
            dragly Svenn-Arne Dragly
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes