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

QQC2: Object destroyed during incubation

    Details

    • Commits:
      51eff608eb18b01d36fdab442930300a4af3df20 ca6b787a01ea289bd5c2a3e4ff3c7442a4ff58fc 3941af88662cdf8bad478813233986e695fa4dcc

      Description

      Using customized controls in item views or asynchronous loader often leads to "Object destroyed during incubation" or "Error creating delegate". The problem occurs with basically any control when replacing the default background, content item, or any other building block with a custom one. Controls cleanup the old default content, which leads to a "Object destroyed during incubation" -error, and then the incubation of the whole control fails.

      In item views the problem occurs occasionally, leading to missing delegate instances (QML VisualDataModel: Error creating delegate):

      import QtQuick 2.6
      import QtQuick.Controls 2.0
      
      ApplicationWindow {
          visible: true
          width: 640
          height: 480
      
          GridView {
              id: gridThing;
              anchors.fill: parent;
              cellWidth: 75;
              cellHeight: 75;
              model: 500;
      
              delegate: Button {
                  id: control
                  text: "Test"
                  width: gridThing.cellWidth;
                  height: gridThing.cellHeight;
                  background: Rectangle {
                      implicitHeight: 20;
                      implicitWidth: 20;
                      color: "red";
                      width: control.width;
                      height: control.height;
                      x: 0;
                      y: 0;
                  }
              }
          }
      }
      

      In asynchronous loaders the issue is 100% reproducible with certain control structures:

      import QtQuick 2.6
      import QtQuick.Controls 2.0
      
      ApplicationWindow {
          id: root
          visible : true
          width   : 640
          height  : 480
      
          property bool  triggerTheBug: true // Swap this to see a normal display of the ComboBox
      
          StackView {
              id: myStackView
              anchors.fill: parent
              initialItem: Loader {
                  anchors.fill: parent
                  asynchronous    : triggerTheBug
                  sourceComponent :
                      ComboBox { popup      : Popup{} }         // BUG
                  //ComboBox { background : Rectangle{} }     // BUG
                  //ComboBox { contentItem: Rectangle{} }     // BUG
                  //ComboBox { delegate   : ItemDelegate{} }  // NO BUG
              }
          }
      }
      

      Under the hood, the problem is that QQmlIncubator + QQmlObjectCreator + QQmlVMEGuard tracks all instantiated child objects using QPointer and doesn't like that any of them gets destroyed during the incubation process. Calling deleteLater() is not sufficient, because it would not be synchronized with the incubation controller.

        Attachments

          Issue Links

          Error rendering 'com.meetme.plugins.jira.gerrit-plugin:gerritreviewsmodule'. Please contact your JIRA administrators.

            Activity

              People

              • Assignee:
                jpnurmi J-P Nurmi
                Reporter:
                taipan BogDan Vatra
              • Votes:
                70 Vote for this issue
                Watchers:
                93 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Gerrit Reviews Side Panel

                  Error rendering 'com.meetme.plugins.jira.gerrit-plugin:gerrit-reviews-side-panel'. Please contact your JIRA administrators.