diff --git a/src/engine/gstenginepipeline.cpp b/src/engine/gstenginepipeline.cpp index 238179c5a..7cfc61878 100644 --- a/src/engine/gstenginepipeline.cpp +++ b/src/engine/gstenginepipeline.cpp @@ -295,6 +295,7 @@ void GstEnginePipeline::set_fading_enabled(const bool enabled) { #ifdef HAVE_SPOTIFY void GstEnginePipeline::set_spotify_access_token(const QString &spotify_access_token) { + QMutexLocker l(&mutex_spotify_access_token_); spotify_access_token_ = spotify_access_token; } #endif // HAVE_SPOTIFY @@ -1065,11 +1066,12 @@ void GstEnginePipeline::SourceSetupCallback(GstElement *playbin, GstElement *sou #ifdef HAVE_SPOTIFY { - QMutexLocker l(&instance->mutex_url_); + QMutexLocker mutex_locker_url(&instance->mutex_url_); if (instance->media_url_.scheme() == u"spotify"_s) { if (g_object_class_find_property(G_OBJECT_GET_CLASS(source), "bitrate")) { g_object_set(source, "bitrate", 2, nullptr); } + QMutexLocker mutex_locker_spotify_access_token(&instance->mutex_spotify_access_token_); if (!instance->spotify_access_token_.isEmpty() && g_object_class_find_property(G_OBJECT_GET_CLASS(source), "access-token")) { const QByteArray access_token = instance->spotify_access_token_.toUtf8(); g_object_set(source, "access-token", access_token.constData(), nullptr); diff --git a/src/engine/gstenginepipeline.h b/src/engine/gstenginepipeline.h index cd41e963f..7441a0185 100644 --- a/src/engine/gstenginepipeline.h +++ b/src/engine/gstenginepipeline.h @@ -263,6 +263,7 @@ class GstEnginePipeline : public QObject { // Spotify #ifdef HAVE_SPOTIFY QString spotify_access_token_; + mutable QMutex mutex_spotify_access_token_; #endif // The URL that is currently playing, and the URL that is to be preloaded when the current track is close to finishing.