Fix for bug 398466 (XBL unlinking triggered hash-table recursion assertion (again)). r/sr=sicking.

This commit is contained in:
peterv%propagandism.org 2007-12-04 18:53:53 +00:00
Родитель 6acf8655cf
Коммит 466495f57d
2 изменённых файлов: 23 добавлений и 0 удалений

Просмотреть файл

@ -328,6 +328,8 @@ SetOrRemoveObject(PLDHashTable& table, nsIContent* aKey, nsISupports* aValue)
// Implement our nsISupports methods // Implement our nsISupports methods
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsBindingManager) NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsBindingManager)
tmp->mDestroyed = PR_TRUE;
if (tmp->mBindingTable.IsInitialized()) if (tmp->mBindingTable.IsInitialized())
tmp->mBindingTable.Clear(); tmp->mBindingTable.Clear();
@ -404,6 +406,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(nsBindingManager)
// Constructors/Destructors // Constructors/Destructors
nsBindingManager::nsBindingManager(nsIDocument* aDocument) nsBindingManager::nsBindingManager(nsIDocument* aDocument)
: mProcessingAttachedStack(PR_FALSE), : mProcessingAttachedStack(PR_FALSE),
mDestroyed(PR_FALSE),
mAttachedStackSizeOnOutermost(0), mAttachedStackSizeOnOutermost(0),
mDocument(aDocument) mDocument(aDocument)
{ {
@ -415,6 +418,8 @@ nsBindingManager::nsBindingManager(nsIDocument* aDocument)
nsBindingManager::~nsBindingManager(void) nsBindingManager::~nsBindingManager(void)
{ {
mDestroyed = PR_TRUE;
if (mContentListTable.ops) if (mContentListTable.ops)
PL_DHashTableFinish(&mContentListTable); PL_DHashTableFinish(&mContentListTable);
if (mAnonymousNodesTable.ops) if (mAnonymousNodesTable.ops)
@ -553,6 +558,11 @@ nsBindingManager::SetInsertionParent(nsIContent* aContent, nsIContent* aParent)
{ {
NS_ASSERTION(!aParent || aParent->HasFlag(NODE_IS_INSERTION_PARENT), NS_ASSERTION(!aParent || aParent->HasFlag(NODE_IS_INSERTION_PARENT),
"Insertion parent should have NODE_IS_INSERTION_PARENT flag!"); "Insertion parent should have NODE_IS_INSERTION_PARENT flag!");
if (mDestroyed) {
return NS_OK;
}
return SetOrRemoveObject(mInsertionParentTable, aContent, aParent); return SetOrRemoveObject(mInsertionParentTable, aContent, aParent);
} }
@ -569,6 +579,10 @@ nsBindingManager::GetWrappedJS(nsIContent* aContent)
nsresult nsresult
nsBindingManager::SetWrappedJS(nsIContent* aContent, nsIXPConnectWrappedJS* aWrappedJS) nsBindingManager::SetWrappedJS(nsIContent* aContent, nsIXPConnectWrappedJS* aWrappedJS)
{ {
if (mDestroyed) {
return NS_OK;
}
return SetOrRemoveObject(mWrapperTable, aContent, aWrappedJS); return SetOrRemoveObject(mWrapperTable, aContent, aWrappedJS);
} }
@ -656,6 +670,10 @@ nsresult
nsBindingManager::SetContentListFor(nsIContent* aContent, nsBindingManager::SetContentListFor(nsIContent* aContent,
nsInsertionPointList* aList) nsInsertionPointList* aList)
{ {
if (mDestroyed) {
return NS_OK;
}
nsIDOMNodeList* contentList = nsnull; nsIDOMNodeList* contentList = nsnull;
if (aList) { if (aList) {
contentList = new nsAnonymousContentList(aList); contentList = new nsAnonymousContentList(aList);
@ -712,6 +730,10 @@ nsresult
nsBindingManager::SetAnonymousNodesFor(nsIContent* aContent, nsBindingManager::SetAnonymousNodesFor(nsIContent* aContent,
nsInsertionPointList* aList) nsInsertionPointList* aList)
{ {
if (mDestroyed) {
return NS_OK;
}
nsIDOMNodeList* contentList = nsnull; nsIDOMNodeList* contentList = nsnull;
if (aList) { if (aList) {
contentList = new nsAnonymousContentList(aList); contentList = new nsAnonymousContentList(aList);

Просмотреть файл

@ -280,6 +280,7 @@ protected:
// A queue of binding attached event handlers that are awaiting execution. // A queue of binding attached event handlers that are awaiting execution.
nsBindingList mAttachedStack; nsBindingList mAttachedStack;
PRPackedBool mProcessingAttachedStack; PRPackedBool mProcessingAttachedStack;
PRPackedBool mDestroyed;
PRUint32 mAttachedStackSizeOnOutermost; PRUint32 mAttachedStackSizeOnOutermost;
// Our posted event to process the attached queue, if any // Our posted event to process the attached queue, if any