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

QtDeclarativePlaylist::removeItem() has undefined impact on QtDeclarativePlaylist::currentIndex

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • None
    • 5.11.2
    • Multimedia
    • None

    Description

      Verified: Applies to QtMultimedia 5.11, 5.15

      The below set of logs contain 3 separate examples of QtDeclarativePlaylist::removeItem() behavior. The first example sees currentIndex set to -1 and currentIndexChanged emitted, triggering the currentIndex log. The second sets currentIndex to -1 but does not emit currentIndexChanged. The last sets currentIndex to 0 and does not emit currentIndexChanged. These all happen when calling removeItem() on an index below currentIndex. Frustratingly, the line of separation between these behaviors seems to be the value of currentIndex. If currentIndex >= 5, the first behavior occurs. It is unclear which of the latter two behaviors will occur when currentIndex < 5 (though more testing may show an exact pattern).

      2000-01-01_01:24:19.54152 qml: QtDeclarativePlaylist::removeItem() (before) currentIndex = 5
      2000-01-01_01:24:19.54187 qml: currentIndex == -1
      2000-01-01_01:24:19.62280 qml: QtDeclarativePlaylist::removeItem() (after) currentIndex = -1
      ...
      2000-01-01_01:24:20.53792 qml: QtDeclarativePlaylist::removeItem() (before) currentIndex = 4
      2000-01-01_01:24:20.56190 qml: QtDeclarativePlaylist::removeItem() (after) currentIndex = -1
      ...
      2000-01-01_01:24:21.34511 qml: QtDeclarativePlaylist::removeItem() (before) currentIndex = 3
      2000-01-01_01:24:21.38927 qml: QtDeclarativePlaylist::removeItem() (after) currentIndex = 0

      And here is pseudocode that demonstrates the issue.

      QDeclarativePlaylist playlist;
      playlist.addItem("/media/zero.mp4");
      playlist.addItem("/media/one.mp4");
      playlist.addItem("/media/two.mp4");
      playlist.addItem("/media/three.mp4");
      playlist.addItem("/media/four.mp4");
      playlist.addItem("/media/five.mp4");
      
      playlist.setCurrentIndex(5);
      cout << "QtDeclarativePlaylist::removeItem() (before)", "currentIndex = " << playlist.currentIndex << std::endl;
      playlist.removeItem(4);
      cout << "QtDeclarativePlaylist::removeItem() (after)", "currentIndex = " << playlist.currentIndex << std::endl;
      
      playlist.setCurrentIndex(4);
      cout << "QtDeclarativePlaylist::removeItem() (before)", "currentIndex = " << playlist.currentIndex << std::endl;
      playlist.removeItem(3);
      cout << "QtDeclarativePlaylist::removeItem() (after)", "currentIndex = " << playlist.currentIndex << std::endl;
      
      playlist.setCurrentIndex(3);
      cout << "QtDeclarativePlaylist::removeItem() (before)", "currentIndex = " << playlist.currentIndex << std::endl;
      playlist.removeItem(2);
      cout << "QtDeclarativePlaylist::removeItem() (after)", "currentIndex = " << playlist.currentIndex << std::endl;
      

      Attachments

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

        Activity

          People

            artemiy Artem Dyomin
            dhandojo Daniel Handojo
            Veli-Pekka Heinonen Veli-Pekka Heinonen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes