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

Crash in TableView

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • P2: Important
    • None
    • 6.8.2
    • Quick: Other
    • None
    • Linux/X11

    Description

      The crash happens in QtDS new design system view. The code that causes the crash looks like the following. Here the line let result = tableView.model.setData(index, prop, Qt.EditRole) inside the onDestruction handler causes the crash. When this line commented out there is no crash.

      The crash happens when going from A to B but not when going from B to A.

      DelegateChooser {
          id: chooser
          role: "group"
      
          // ...
      
          DelegateChoice {
              roleValue: GroupType.Numbers
      
              DataCell {
                  id: numberDelegate
      
                  Text {
                      anchors.fill: parent
                      leftPadding: root.leftPadding
                      rightPadding: root.rightPadding
      
                      horizontalAlignment: TextInput.AlignLeft
                      verticalAlignment: TextInput.AlignVCenter
      
                      color: numberDelegate.isBinding ? StudioTheme.Values.themeInteraction
                                                      : StudioTheme.Values.themeTextColor
                      // -128 is the value of QLocale::FloatingPointShortest
                      text: Number(numberDelegate.resolvedValue).toLocaleString(Utils.locale, 'f', -128)
                  }
      
                  // This edit delegate has two different controls, one for number editing and one for
                  // binding editing. Depending on the mode one is hidden and the other is shown.
                  TableView.editDelegate: FocusScope {
                      anchors.fill: parent
      
                      DSC.SpinBox {
                          id: numberEditDelegate
      
                          style: root.customStyle
      
                          anchors.fill: parent
      
                          realValue: numberDelegate.resolvedValue
                          from: -1000 // TODO define min/max
                          to: 1000
                          editable: true
                          decimals: 2
      
                          focus: !numberDelegate.bindingEditor
                          visible: !numberDelegate.bindingEditor
      
                          Component.onCompleted: console.log("numberEditDelegate.onCompleted")
                          Component.onDestruction: {
                              console.log("Destruction Beginning!")
      
                              let val = numberEditDelegate.realValue
                              console.log(">>> onCommit", val)
                              let index = tableView.index(numberDelegate.row, numberDelegate.column)
                              var prop = DesignSystemBackend.dsInterface.createThemeProperty("",
                                                                                              val,
                                                                                              numberDelegate.bindingEditor)
                              let result = tableView.model.setData(index, prop, Qt.EditRole)
                              //Qt.callLater(tableView.model.setData, index, prop, Qt.EditRole)
                              console.log("Destruction end", result)
                          }
                      }
      
                      DSC.TextField {
                          id: numberBindingEditDelegate
      
                          style: root.customStyle
      
                          anchors.fill: parent
                          leftPadding: root.leftPadding
                          rightPadding: root.rightPadding
      
                          horizontalAlignment: TextInput.AlignLeft
                          verticalAlignment: TextInput.AlignVCenter
      
                          text: numberDelegate.propertyValue
      
                          focus: numberDelegate.bindingEditor
                          visible: numberDelegate.bindingEditor
      
                          Component.onCompleted: numberBindingEditDelegate.selectAll()
                          Component.onDestruction: numberDelegate.creatingBinding = false
                      }
      
                      TableView.onCommit: {
                          numberEditDelegate.valueFromText(numberEditDelegate.contentItem.text,
                                                              numberEditDelegate.locale)
                          // Don't use return value of valueFromText as the return value is int and
                          // for a real value SpinBox this isn't working.
                          let val = numberEditDelegate.realValue
      
                          console.log("onCommit", val)
                          let index = TableView.view.index(numberDelegate.row, numberDelegate.column)
                          var prop = DesignSystemBackend.dsInterface.createThemeProperty("",
                                                                                          val,
                                                                                          numberDelegate.bindingEditor)
                          let result = TableView.view.model.setData(index, prop, Qt.EditRole)
                          console.log("setData", result)
                      }
                  }
      
                  Component.onCompleted: console.log("DelegateChoice - number", numberDelegate.resolvedValue)
              }
          }
      }
      
      1  QQuickItem::size                                        qquickitem.cpp               7676 0x7fffc3b6c38c 
      2  QQuickItemViewFxItem::geometry                          qquickitemviewfxitem.cpp     104  0x7fffc3e7c12a 
      3  QQuickTableViewPrivate::getEffectiveRowHeight           qquicktableview.cpp          3043 0x7fffc3e97ede 
      4  QQuickTableView::cellAtPosition                         qquicktableview.cpp          6378 0x7fffc3e9bf67 
      5  QQuickTableViewHoverHandler::handleEventPoint           qquicktableview.cpp          6990 0x7fffc3eb2f8a 
      6  QQuickSinglePointHandler::handlePointerEventImpl        qquicksinglepointhandler.cpp 116  0x7fffc3b2850d 
      7  QQuickPointerHandler::handlePointerEvent                qquickpointerhandler.cpp     718  0x7fffc3b25928 
      8  QQuickDeliveryAgentPrivate::deliverHoverEventToItem     qquickdeliveryagent.cpp      1302 0x7fffc3d445cb 
      9  QQuickDeliveryAgentPrivate::deliverHoverEventRecursive  qquickdeliveryagent.cpp      1219 0x7fffc3d45471 
      10 QQuickDeliveryAgentPrivate::deliverHoverEventRecursive  qquickdeliveryagent.cpp      1206 0x7fffc3d4542d 
      11 QQuickDeliveryAgentPrivate::deliverHoverEventRecursive  qquickdeliveryagent.cpp      1206 0x7fffc3d4542d 
      12 QQuickDeliveryAgentPrivate::deliverHoverEventRecursive  qquickdeliveryagent.cpp      1206 0x7fffc3d4542d 
      13 QQuickDeliveryAgentPrivate::deliverHoverEventRecursive  qquickdeliveryagent.cpp      1206 0x7fffc3d4542d 
      14 QQuickDeliveryAgentPrivate::deliverHoverEventRecursive  qquickdeliveryagent.cpp      1206 0x7fffc3d4542d 
      15 QQuickDeliveryAgentPrivate::deliverHoverEventRecursive  qquickdeliveryagent.cpp      1206 0x7fffc3d4542d 
      16 QQuickDeliveryAgentPrivate::deliverHoverEvent           qquickdeliveryagent.cpp      1124 0x7fffc3d45794 
      17 QQuickDeliveryAgentPrivate::flushFrameSynchronousEvents qquickdeliveryagent.cpp      1837 0x7fffc3d497fb 
      19 QQuickWidgetPrivate::render                             qquickwidget.cpp             386  0x7fffcbf52df5 
      20 QQuickWidgetPrivate::renderSceneGraph                   qquickwidget.cpp             424  0x7fffcbf52eda 
      21 QObject::event                                          qobject.cpp                  1448 0x7ffff5b9061f 
      22 QApplicationPrivate::notify_helper                      qapplication.cpp             3296 0x7ffff6ede7a6 
      23 QCoreApplication::notifyInternal2                       qcoreapplication.cpp         1172 0x7ffff5b3ac32 
      24 QTimerInfoList::activateTimers                          qtimerinfo_unix.cpp          426  0x7ffff5ce774a 
      25 timerSourceDispatch                                     qeventdispatcher_glib.cpp    152  0x7ffff5e1697c 
      29 QEventDispatcherGlib::processEvents                     qeventdispatcher_glib.cpp    399  0x7ffff5e16b8e 
      30 QEventLoop::exec                                        qflags.h                     34   0x7ffff5b4730b 
      31 QCoreApplication::exec                                  qflags.h                     74   0x7ffff5b432f6 
      32 main                                                    main.cpp                     975  0x555555567885 
      

      Attachments

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

        Activity

          People

            richard Richard Moe Gustavsen
            henning Henning Gründl
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes