Fix memory leaks from changeset dcda49ff1a26 - need to make sure that

the destructor gets called for the hashtable entries.

Also fixes a nit (AddRef() -> NS_ADDREF_THIS())

r+sr=bz
This commit is contained in:
Christian Biesinger 2009-07-28 19:46:04 +02:00
parent d5f00639ad
commit ce834cd636
2 changed files with 8 additions and 2 deletions

View File

@ -183,7 +183,7 @@ nsProgressNotificationProxy::GetInterface(const nsIID& iid,
void** result) { void** result) {
if (iid.Equals(NS_GET_IID(nsIProgressEventSink))) { if (iid.Equals(NS_GET_IID(nsIProgressEventSink))) {
*result = static_cast<nsIProgressEventSink*>(this); *result = static_cast<nsIProgressEventSink*>(this);
AddRef(); NS_ADDREF_THIS();
return NS_OK; return NS_OK;
} }
if (mOriginalCallbacks) if (mOriginalCallbacks)

View File

@ -126,6 +126,12 @@ RequestInfoHashInitEntry(PLDHashTable *table, PLDHashEntryHdr *entry,
return PR_TRUE; return PR_TRUE;
} }
static void
RequestInfoHashClearEntry(PLDHashTable *table, PLDHashEntryHdr *entry)
{
nsRequestInfo* info = static_cast<nsRequestInfo *>(entry);
info->~nsRequestInfo();
}
struct nsListenerInfo { struct nsListenerInfo {
nsListenerInfo(nsIWeakReference *aListener, unsigned long aNotifyMask) nsListenerInfo(nsIWeakReference *aListener, unsigned long aNotifyMask)
@ -162,7 +168,7 @@ nsDocLoader::nsDocLoader()
PL_DHashVoidPtrKeyStub, PL_DHashVoidPtrKeyStub,
PL_DHashMatchEntryStub, PL_DHashMatchEntryStub,
PL_DHashMoveEntryStub, PL_DHashMoveEntryStub,
PL_DHashClearEntryStub, RequestInfoHashClearEntry,
PL_DHashFinalizeStub, PL_DHashFinalizeStub,
RequestInfoHashInitEntry RequestInfoHashInitEntry
}; };