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

Application crashes with assert when closing the window with TableView

XMLWordPrintable

    • Windows
    • 2cfffb708 (dev), bb49bef6d (6.8), db0023bf6 (6.7), 43d220354 (tqtc/lts-6.5), e9e47769a (tqtc/lts-6.2)

      Application crashes with assert failure when closing the window with TableView scrolled to the bottom

      When the application window is closed, it crashes with the following assertion failure:

      ASSERT: "m_qmlContext && m_qmlContext->isValid()" in file C:\Users\qt\work\qt\qtdeclarative\src\qmlmodels\qqmltableinstancemodel.cpp, line 125

      This issue is observed specifically when there is a header present on the Page, and the TableView is scrolled to the bottom, either using contentY: Math.max(0, contentHeight - height) or manually by the user.

      Notes:

      • The issue does not occur if the header is removed or its height is changed to 38, for example.
      • The issue also does not occur if the TableView is not scrolled to the bottom.
      • The issue could only be reproduced on Windows. It does not reproduce on macOS.

      Code to Reproduce:

      import QtQuick
      import QtQuick.Controls
      
      ApplicationWindow {
          width: 720
          height: 480
          visible: true    
          Page {
              anchors.fill: parent        
              header: Rectangle {
                  height: 40
                  color: "red"
              }        
              TableView {
                  anchors.fill: parent
                  model: 15            
                  contentY: Math.max(0, contentHeight - height)
                  contentHeight: 40 * rows            
                  rowHeightProvider: () => 40
                  columnWidthProvider: () => 200            
                  delegate : Rectangle {
                      width: 40;
                      height: 40;
                      color: "green"                
                      Text {
                          anchors.fill: parent
                          text: index
                      }
                  }
              }
          }
      }
      

        For Gerrit Dashboard: QTBUG-126981
        # Subject Branch Project Status CR V

            santhoshkumar Santhosh Kumar Selvaraj
            xorknown_cmt Oleg Rudakov
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: