Fix crash on skin switching. r=ben

This commit is contained in:
hyatt%netscape.com 2000-09-03 06:00:09 +00:00
parent be4ff1fbf1
commit ba7b94b9b1
4 changed files with 20 additions and 16 deletions

View File

@ -585,19 +585,21 @@ nsXBLEventHandler::RemoveEventHandlers()
if (mNextHandler)
mNextHandler->RemoveEventHandlers();
if (mEventName == NS_LITERAL_STRING("bindingattached") ||
mEventName == NS_LITERAL_STRING("bindingdetached")) {
// Release and drop.
NS_RELEASE_THIS();
return;
}
// Figure out if we're using capturing or not.
if (!mProtoHandler)
return;
if (mEventName == NS_LITERAL_STRING("bindingattached") ||
mEventName == NS_LITERAL_STRING("bindingdetached")) {
// Release and drop.
mProtoHandler = nsnull;
NS_RELEASE_THIS();
return;
}
nsCOMPtr<nsIContent> handlerElement;
mProtoHandler->GetHandlerElement(getter_AddRefs(handlerElement));
mProtoHandler = nsnull;
if (!handlerElement)
return;

View File

@ -127,7 +127,7 @@ protected:
protected:
nsIDOMEventReceiver* mEventReceiver; // Both of these refs are weak.
nsIXBLPrototypeHandler* mProtoHandler;
nsCOMPtr<nsIXBLPrototypeHandler> mProtoHandler;
nsAutoString mEventName;

View File

@ -585,19 +585,21 @@ nsXBLEventHandler::RemoveEventHandlers()
if (mNextHandler)
mNextHandler->RemoveEventHandlers();
if (mEventName == NS_LITERAL_STRING("bindingattached") ||
mEventName == NS_LITERAL_STRING("bindingdetached")) {
// Release and drop.
NS_RELEASE_THIS();
return;
}
// Figure out if we're using capturing or not.
if (!mProtoHandler)
return;
if (mEventName == NS_LITERAL_STRING("bindingattached") ||
mEventName == NS_LITERAL_STRING("bindingdetached")) {
// Release and drop.
mProtoHandler = nsnull;
NS_RELEASE_THIS();
return;
}
nsCOMPtr<nsIContent> handlerElement;
mProtoHandler->GetHandlerElement(getter_AddRefs(handlerElement));
mProtoHandler = nsnull;
if (!handlerElement)
return;

View File

@ -127,7 +127,7 @@ protected:
protected:
nsIDOMEventReceiver* mEventReceiver; // Both of these refs are weak.
nsIXBLPrototypeHandler* mProtoHandler;
nsCOMPtr<nsIXBLPrototypeHandler> mProtoHandler;
nsAutoString mEventName;