Skip to content

dataengines/mpris2: Do not create a new container if there is a pending container with the same name

dataengines/mpris2: Do not create a new container if there is a pending container with the same name

It's possible that a container createdin Mpris2Engine::serviceNameFetchFinished has not emitted PlayerContainer::initialFetchFinished yet, but Mpris2Engine::serviceOwnerChanged has already created a container with the same name.

A possible order that will create two containers with the same name:

  1. serviceNameFetchFinished calls addMediaPlayer
  2. addMediaPlayer creates a new PlayerContainer
  3. Mpris2Engine::initialFetchFinished is not emitted.
  4. serviceOwnerChanged watcher starts.
  5. QDBusServiceWatcher::serviceOwnerChanged -> Mpris2Engine::serviceOwnerChanged
  6. Mpris2Engine::serviceOwnerChanged calls addMediaPlayer
  7. addMediaPlayer creates a new PlayerContainer with the same sourceName in STEP 2.
  8. Crash

BUG: 446531

Edited by Fushan Wen

Merge request reports

Loading