Skip to content

Commit

Permalink
Fixed an issue where timer.start() would be called from a different t…
Browse files Browse the repository at this point in the history
…hread
  • Loading branch information
PhilInTheGaps committed Nov 6, 2023
1 parent 0975e65 commit 0a428ca
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/tools/audio/thumbnails/loaders/spotifyimageloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,8 +231,13 @@ void SpotifyImageLoader::startTimer(SpotifyUtils::SpotifyType type)

if (timer && !timer->isActive())
{
auto *rng = QRandomGenerator::system();
timer->start(DEFAULT_TIMEOUT_MS + rng->bounded(RANDOM_TIMEOUT_MS));
QMetaObject::invokeMethod(
timer,
[timer]() {
auto *rng = QRandomGenerator::system();
timer->start(DEFAULT_TIMEOUT_MS + rng->bounded(RANDOM_TIMEOUT_MS));
},
Qt::ConnectionType::QueuedConnection);
}
}

Expand Down

0 comments on commit 0a428ca

Please sign in to comment.