Bug 504473 FORWARD_NULL deref of mPresContext in nsEventStateManager::GetEventTarget

r=smaug sr=smaug
This commit is contained in:
timeless@mozdev.org 2009-07-22 17:31:01 -05:00
Родитель 5e7740d543
Коммит 267275b06b
1 изменённых файлов: 16 добавлений и 16 удалений

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

@ -3719,25 +3719,25 @@ nsEventStateManager::CheckForAndDispatchClick(nsPresContext* aPresContext,
NS_IMETHODIMP
nsEventStateManager::GetEventTarget(nsIFrame **aFrame)
{
if (!mCurrentTarget && mCurrentTargetContent) {
if (mPresContext) {
nsIPresShell *shell = mPresContext->GetPresShell();
if (shell) {
mCurrentTarget = shell->GetPrimaryFrameFor(mCurrentTargetContent);
}
nsIPresShell *shell;
if (mCurrentTarget ||
!mPresContext ||
!(shell = mPresContext->GetPresShell())) {
*aFrame = mCurrentTarget;
return NS_OK;
}
if (mCurrentTargetContent) {
mCurrentTarget = shell->GetPrimaryFrameFor(mCurrentTargetContent);
if (mCurrentTarget) {
*aFrame = mCurrentTarget;
return NS_OK;
}
}
if (!mCurrentTarget) {
nsIPresShell *presShell = mPresContext->GetPresShell();
if (presShell) {
nsIFrame* frame = nsnull;
presShell->GetEventTargetFrame(&frame);
mCurrentTarget = frame;
}
}
*aFrame = mCurrentTarget;
nsIFrame* frame = nsnull;
shell->GetEventTargetFrame(&frame);
*aFrame = mCurrentTarget = frame;
return NS_OK;
}