aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSascha Montellese <sascha.montellese@gmail.com>2015-02-22 18:55:36 +0100
committerSascha Montellese <sascha.montellese@gmail.com>2015-02-22 18:55:36 +0100
commit9b55f9b09173ecc3886469b16ea2d05659f05db9 (patch)
tree698b91188ab04b1667582da71087b5ae0233839c
parentb23b15529bdab6f28a0555830273f8d88a9aa16d (diff)
parentd70da61ad708926738a385fb9a9381177f1d11b4 (diff)
Merge pull request #6421 from ksooo/fix-announcementmanager-announce
fix AnnouncementManager::Announce()
-rw-r--r--xbmc/interfaces/AnnouncementManager.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/xbmc/interfaces/AnnouncementManager.cpp b/xbmc/interfaces/AnnouncementManager.cpp
index 4c09af164c..91014005ae 100644
--- a/xbmc/interfaces/AnnouncementManager.cpp
+++ b/xbmc/interfaces/AnnouncementManager.cpp
@@ -90,9 +90,13 @@ void CAnnouncementManager::Announce(AnnouncementFlag flag, const char *sender, c
void CAnnouncementManager::Announce(AnnouncementFlag flag, const char *sender, const char *message, CVariant &data)
{
CLog::Log(LOGDEBUG, "CAnnouncementManager - Announcement: %s from %s", message, sender);
+
CSingleLock lock (m_critSection);
- for (unsigned int i = 0; i < m_announcers.size(); i++)
- m_announcers[i]->Announce(flag, sender, message, data);
+
+ // Make a copy of announers. They may be removed or even remove themselves during execution of IAnnouncer::Announce()!
+ std::vector<IAnnouncer *> announcers(m_announcers);
+ for (unsigned int i = 0; i < announcers.size(); i++)
+ announcers[i]->Announce(flag, sender, message, data);
}
void CAnnouncementManager::Announce(AnnouncementFlag flag, const char *sender, const char *message, CFileItemPtr item)