diff --git a/content/events/src/nsEventStateManager.cpp b/content/events/src/nsEventStateManager.cpp index 9a2b8a536320..2f3e2eccdf41 100644 --- a/content/events/src/nsEventStateManager.cpp +++ b/content/events/src/nsEventStateManager.cpp @@ -2346,7 +2346,7 @@ nsIFrame* nsEventStateManager::GetDocumentFrame(nsIPresContext* aPresContext) { nsCOMPtr presShell; - nsIDocument* aDocument; + nsCOMPtr aDocument; nsIFrame* aFrame; nsIView* aView; @@ -2357,8 +2357,9 @@ nsEventStateManager::GetDocumentFrame(nsIPresContext* aPresContext) return nsnull; } - presShell->GetDocument(&aDocument); - presShell->GetPrimaryFrameFor(aDocument->GetRootContent(), &aFrame); + presShell->GetDocument(getter_AddRefs(aDocument)); + nsCOMPtr rootContent(dont_AddRef(aDocument->GetRootContent())); + presShell->GetPrimaryFrameFor(rootContent, &aFrame); aFrame->GetView(aPresContext, &aView); PR_LOG(MOUSEWHEEL, PR_LOG_DEBUG, ("GetDocumentFrame: got document view = %p\n", aView)); diff --git a/layout/events/src/nsEventStateManager.cpp b/layout/events/src/nsEventStateManager.cpp index 9a2b8a536320..2f3e2eccdf41 100644 --- a/layout/events/src/nsEventStateManager.cpp +++ b/layout/events/src/nsEventStateManager.cpp @@ -2346,7 +2346,7 @@ nsIFrame* nsEventStateManager::GetDocumentFrame(nsIPresContext* aPresContext) { nsCOMPtr presShell; - nsIDocument* aDocument; + nsCOMPtr aDocument; nsIFrame* aFrame; nsIView* aView; @@ -2357,8 +2357,9 @@ nsEventStateManager::GetDocumentFrame(nsIPresContext* aPresContext) return nsnull; } - presShell->GetDocument(&aDocument); - presShell->GetPrimaryFrameFor(aDocument->GetRootContent(), &aFrame); + presShell->GetDocument(getter_AddRefs(aDocument)); + nsCOMPtr rootContent(dont_AddRef(aDocument->GetRootContent())); + presShell->GetPrimaryFrameFor(rootContent, &aFrame); aFrame->GetView(aPresContext, &aView); PR_LOG(MOUSEWHEEL, PR_LOG_DEBUG, ("GetDocumentFrame: got document view = %p\n", aView));