Skip to content

Commit

Permalink
fix unregiser of observer/observable
Browse files Browse the repository at this point in the history
  • Loading branch information
FernetMenta committed Sep 10, 2014
1 parent f78c550 commit 401ff6e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions xbmc/utils/Observer.cpp
Expand Up @@ -33,9 +33,9 @@ Observer::~Observer(void)
void Observer::StopObserving(void)
{
CSingleLock lock(m_obsCritSection);
for (unsigned int iObsPtr = 0; iObsPtr < m_observables.size(); iObsPtr++)
m_observables.at(iObsPtr)->UnregisterObserver(this);
m_observables.clear();
std::vector<Observable *> observables = m_observables;
for (unsigned int iObsPtr = 0; iObsPtr < observables.size(); iObsPtr++)
observables.at(iObsPtr)->UnregisterObserver(this);
}

bool Observer::IsObserving(const Observable &obs) const
Expand Down Expand Up @@ -84,9 +84,9 @@ Observable &Observable::operator=(const Observable &observable)
void Observable::StopObserver(void)
{
CSingleLock lock(m_obsCritSection);
for (unsigned int iObsPtr = 0; iObsPtr < m_observers.size(); iObsPtr++)
m_observers.at(iObsPtr)->UnregisterObservable(this);
m_observers.clear();
std::vector<Observer *> observers = m_observers;
for (unsigned int iObsPtr = 0; iObsPtr < observers.size(); iObsPtr++)
observers.at(iObsPtr)->UnregisterObservable(this);
}

bool Observable::IsObserving(const Observer &obs) const
Expand Down

0 comments on commit 401ff6e

Please sign in to comment.