Skip to content

Commit 98cce52

Browse files
committed
qtui: Inhibit tab changed signal during a playlist update.
This fixes an issue where the wrong playlist could be activated if a plugin simultaneous deletes a playlist and activates a different one than Qt wants to activate. See: https://redmine.audacious-media-player.org/boards/2/topics/2592
1 parent 5093d77 commit 98cce52

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/qtui/playlist_tabs.cc

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,8 @@ void PlaylistTabs::addRemovePlaylists()
158158

159159
void PlaylistTabs::currentChangedTrigger(int idx)
160160
{
161-
Playlist::by_index(idx).activate();
161+
if (!m_in_update)
162+
Playlist::by_index(idx).activate();
162163
}
163164

164165
bool PlaylistTabs::eventFilter(QObject * obj, QEvent * e)
@@ -186,12 +187,15 @@ void PlaylistTabs::renameCurrent()
186187

187188
void PlaylistTabs::playlist_activate_cb()
188189
{
190+
m_in_update = true;
189191
setCurrentIndex(Playlist::active_playlist().index());
190192
m_tabbar->cancelRename();
193+
m_in_update = false;
191194
}
192195

193196
void PlaylistTabs::playlist_update_cb(Playlist::UpdateLevel global_level)
194197
{
198+
m_in_update = true;
195199
if (global_level == Playlist::Structure)
196200
addRemovePlaylists();
197201
if (global_level >= Playlist::Metadata)
@@ -201,6 +205,7 @@ void PlaylistTabs::playlist_update_cb(Playlist::UpdateLevel global_level)
201205
playlistWidget(i)->playlistUpdate();
202206

203207
setCurrentIndex(Playlist::active_playlist().index());
208+
m_in_update = false;
204209
}
205210

206211
void PlaylistTabs::playlist_position_cb(Playlist list)

src/qtui/playlist_tabs.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ class PlaylistTabs : public QTabWidget
4848
private:
4949
QMenu * m_pl_menu;
5050
PlaylistTabBar * m_tabbar;
51+
bool m_in_update = false;
5152

5253
void activateSearch();
5354
void addRemovePlaylists();

0 commit comments

Comments
 (0)