Browse Source

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.
pull/192/head
Fatih Uzunoglu 9 months ago
committed by Felix Paul Kühne
parent
commit
31b9abc49c
  1. 11
      modules/gui/qt/playlist/playlist_controller.cpp

11
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();
}
});
}

Loading…
Cancel
Save