diff --git a/content/base/src/nsCopySupport.cpp b/content/base/src/nsCopySupport.cpp index 3bf48e7aa242..8925e1f50463 100644 --- a/content/base/src/nsCopySupport.cpp +++ b/content/base/src/nsCopySupport.cpp @@ -92,7 +92,7 @@ nsresult nsCopySupport::HTMLCopy(nsISelection *aSel, nsIDocument *aDoc, PRInt16 nsCOMPtr doc = do_QueryInterface(aDoc); if (doc) { - nsIPresShell* shell = doc->GetShellAt(0); + nsCOMPtr shell(dont_AddRef(doc->GetShellAt(0))); if (shell) { nsCOMPtr context; shell->GetPresContext(getter_AddRefs(context) ); diff --git a/layout/base/src/nsCopySupport.cpp b/layout/base/src/nsCopySupport.cpp index 3bf48e7aa242..8925e1f50463 100644 --- a/layout/base/src/nsCopySupport.cpp +++ b/layout/base/src/nsCopySupport.cpp @@ -92,7 +92,7 @@ nsresult nsCopySupport::HTMLCopy(nsISelection *aSel, nsIDocument *aDoc, PRInt16 nsCOMPtr doc = do_QueryInterface(aDoc); if (doc) { - nsIPresShell* shell = doc->GetShellAt(0); + nsCOMPtr shell(dont_AddRef(doc->GetShellAt(0))); if (shell) { nsCOMPtr context; shell->GetPresContext(getter_AddRefs(context) );