diff --git a/src/core/mainwindow.cpp b/src/core/mainwindow.cpp index 34b17618..c8f0c2a3 100644 --- a/src/core/mainwindow.cpp +++ b/src/core/mainwindow.cpp @@ -1431,8 +1431,9 @@ void MainWindow::LoadPlaybackStatus() { s.endGroup(); if (resume_playback && playback_state != Engine::Empty && playback_state != Engine::Idle) { - QObject::connect(app_->playlist_manager(), &PlaylistManager::AllPlaylistsLoaded, this, [this]() { - QObject::disconnect(app_->playlist_manager(), &PlaylistManager::AllPlaylistsLoaded, this, &MainWindow::ResumePlayback); + std::shared_ptr connection = std::make_shared(); + *connection = QObject::connect(app_->playlist_manager(), &PlaylistManager::AllPlaylistsLoaded, this, [this, connection]() { + QObject::disconnect(*connection); QTimer::singleShot(400, this, &MainWindow::ResumePlayback); }); }