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

StackLayout will crashed when currentIndex is initialized as number less than -1

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.15.2
    • Quick: Layouts
    • None
    • Linux/Yocto

    Description

      Steps to repoduceļ¼š

      1. Create a qml project, and import QtQuick.Layouts 1.12 module
      2. Initialize an object StackLayout
      3. Set 'currentIndex' as -2 or any value less than -1
      4. Run the project , you will see project crashed.

      I have debugged this with source code and found function 'rearrange' of class QQuickStackLayout contains following code which maybe better to change it like '<= -1'.

      if (d->currentIndex == -1 || d->currentIndex >= m_cachedItemSizeHints.count())
              return;
      

      Attachments

        Activity

          People

            zhiqiang.duan Zhiqiang Duan
            zhiqiang.duan Zhiqiang Duan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated: