mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 549882 - ###!!! ASSERTION: Trying to unregister a node that wasn't registered!
Also adds some assertions to make sure we do not leak the observer arrays. r=dietrich
This commit is contained in:
parent
9f5d0cab2d
commit
d77cdfd47b
@ -163,6 +163,12 @@ History::History()
|
||||
History::~History()
|
||||
{
|
||||
gService = NULL;
|
||||
#ifdef DEBUG
|
||||
if (mObservers.IsInitialized()) {
|
||||
NS_ASSERTION(mObservers.Count() == 0,
|
||||
"Not all Links were removed before we disappear!");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
@ -241,18 +247,24 @@ History::RegisterVisitedCallback(nsIURI* aURI,
|
||||
}
|
||||
|
||||
// Obtain our array of observers for this URI.
|
||||
#ifdef DEBUG
|
||||
bool keyAlreadyExists = !!mObservers.GetEntry(aURI);
|
||||
#endif
|
||||
KeyClass* key = mObservers.PutEntry(aURI);
|
||||
NS_ENSURE_TRUE(key, NS_ERROR_OUT_OF_MEMORY);
|
||||
ObserverArray& observers = key->array;
|
||||
|
||||
if (observers.IsEmpty()) {
|
||||
NS_ASSERTION(!keyAlreadyExists,
|
||||
"An empty key was kept around in our hashtable!");
|
||||
|
||||
// We are the first Link node to ask about this URI, or there are no pending
|
||||
// Links wanting to know about this URI. Therefore, we should query the
|
||||
// database now.
|
||||
nsresult rv = VisitedQuery::Start(aURI);
|
||||
if (NS_FAILED(rv)) {
|
||||
// Curses - unregister and return failure.
|
||||
(void)UnregisterVisitedCallback(aURI, aLink);
|
||||
// Remove our array from the hashtable so we don't keep it around.
|
||||
mObservers.RemoveEntry(aURI);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user