mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 735778 - Call MOZ_ASSERT if RemoveObserver is called with an observer that is not present. r=jlebar
This commit is contained in:
parent
675be045de
commit
6ea2bd057f
15
hal/Hal.cpp
15
hal/Hal.cpp
@ -179,13 +179,16 @@ public:
|
||||
}
|
||||
|
||||
void RemoveObserver(Observer<InfoType>* aObserver) {
|
||||
// If mObservers is null, that means there are no observers, so removing one
|
||||
// must be a no-op.
|
||||
if (!mObservers) {
|
||||
return;
|
||||
}
|
||||
// If mObservers is null, that means there are no observers.
|
||||
// In addition, if RemoveObserver() returns false, that means we didn't
|
||||
// find the observer.
|
||||
// In both cases, that is a logical error we want to make sure the developer
|
||||
// notices.
|
||||
|
||||
mObservers->RemoveObserver(aObserver);
|
||||
MOZ_ASSERT(mObservers);
|
||||
|
||||
DebugOnly<bool> removed = mObservers->RemoveObserver(aObserver);
|
||||
MOZ_ASSERT(removed);
|
||||
|
||||
if (mObservers->Length() == 0) {
|
||||
DisableNotifications();
|
||||
|
@ -81,8 +81,12 @@ public:
|
||||
mObservers.AppendElement(aObserver);
|
||||
}
|
||||
|
||||
void RemoveObserver(Observer<T>* aObserver) {
|
||||
mObservers.RemoveElement(aObserver);
|
||||
/**
|
||||
* Remove the observer from the observer list.
|
||||
* @return Whether the observer has been found in the list.
|
||||
*/
|
||||
bool RemoveObserver(Observer<T>* aObserver) {
|
||||
return mObservers.RemoveElement(aObserver);
|
||||
}
|
||||
|
||||
PRUint32 Length() {
|
||||
|
Loading…
Reference in New Issue
Block a user