Fix channels not going offline properly

This commit is contained in:
Rasmus Karlsson 2018-04-14 18:27:13 +02:00
parent d0a6974827
commit 0b18a8331a

View file

@ -181,14 +181,16 @@ void TwitchChannel::addRecentChatter(const std::shared_ptr<messages::Message> &m
void TwitchChannel::setLive(bool newLiveStatus) void TwitchChannel::setLive(bool newLiveStatus)
{ {
bool gotNewLiveStatus = false;
{ {
std::lock_guard<std::mutex> lock(this->streamStatusMutex); std::lock_guard<std::mutex> lock(this->streamStatusMutex);
if (this->streamStatus.live != newLiveStatus) { if (this->streamStatus.live != newLiveStatus) {
gotNewLiveStatus = true;
this->streamStatus.live = newLiveStatus; this->streamStatus.live = newLiveStatus;
} }
} }
if (newLiveStatus) { if (gotNewLiveStatus) {
this->updateLiveInfo.invoke(); this->updateLiveInfo.invoke();
} }
} }