From 31b9abc49c938252c24c05871468df5444ea4bed Mon Sep 17 00:00:00 2001 From: Fatih Uzunoglu Date: Wed, 19 Nov 2025 17:10:36 +0200 Subject: [PATCH] qt: do not signal current item change unnecessarily in `PlaylistController` #2 This was missed in 776121f3 because I thought, as the callback name implied, it would be called when the current item changed so checking if the current item changed would be redundant. However, the callback is actually for current index change, so we also have to compare the current item there before signalling the change to prevent unnecessarily signalling the change. --- modules/gui/qt/playlist/playlist_controller.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/modules/gui/qt/playlist/playlist_controller.cpp b/modules/gui/qt/playlist/playlist_controller.cpp index 1e3449c214..48fd9a27c1 100644 --- a/modules/gui/qt/playlist/playlist_controller.cpp +++ b/modules/gui/qt/playlist/playlist_controller.cpp @@ -290,8 +290,15 @@ on_playlist_current_index_changed(vlc_playlist_t *playlist, ssize_t index, that->m_currentIndex = index; emit q->currentIndexChanged(that->m_currentIndex); } - that->m_currentItem = newItem; - emit q->currentItemChanged(); + + // Unlike items updated callback, we should not need to unconditionally + // set the current item to update data because this is only a current + // index changed callback. + if (that->m_currentItem.raw() != newItem.raw()) + { + that->m_currentItem = newItem; + emit q->currentItemChanged(); + } }); }