lock mutex in other places

This commit is contained in:
Bruno Morais 2019-09-05 21:00:39 -04:00
parent 046b6954ee
commit 0348082c16

View File

@ -84,6 +84,7 @@ static class MPRISRemote : public IPlaybackRemote {
void MPRISEmitChange(MPRISProperty prop) { void MPRISEmitChange(MPRISProperty prop) {
if (bus) { if (bus) {
char** strv = (char**)(&MPRISPropertyNames.at(prop)); char** strv = (char**)(&MPRISPropertyNames.at(prop));
std::unique_lock<decltype(sd_mutex)> lock(sd_mutex);
sd_bus_emit_properties_changed_strv(bus, "/org/mpris/MediaPlayer2", sd_bus_emit_properties_changed_strv(bus, "/org/mpris/MediaPlayer2",
"org.mpris.MediaPlayer2.Player", "org.mpris.MediaPlayer2.Player",
strv); strv);
@ -94,6 +95,7 @@ static class MPRISRemote : public IPlaybackRemote {
void MPRISEmitSeek(double curpos) { void MPRISEmitSeek(double curpos) {
if (bus) { if (bus) {
int64_t position = (int64_t)(curpos*1000*1000); int64_t position = (int64_t)(curpos*1000*1000);
std::unique_lock<decltype(sd_mutex)> lock(sd_mutex);
sd_bus_emit_signal(bus, "/org/mpris/MediaPlayer2", sd_bus_emit_signal(bus, "/org/mpris/MediaPlayer2",
"org.mpris.MediaPlayer2.Player", "org.mpris.MediaPlayer2.Player",
"Seeked", "x", position); "Seeked", "x", position);