From 1b2e88bca78b0354030c90691d11375120edf1a3 Mon Sep 17 00:00:00 2001 From: "tbogard%aol.net" Date: Tue, 8 Feb 2000 20:19:00 +0000 Subject: [PATCH] When creating a new COM C++ object the refcount starts out at 0. Though we will QI before we return it out, we need to ensure COMPtr's used during init don't take the count to 1 and then back to 0. So we temporarily locally bump the count to 1 to represent our ownership during the scope of the function. r=mscott --- xpfe/appshell/src/nsAppShellService.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/xpfe/appshell/src/nsAppShellService.cpp b/xpfe/appshell/src/nsAppShellService.cpp index f0c7058d98f..a59088cf539 100644 --- a/xpfe/appshell/src/nsAppShellService.cpp +++ b/xpfe/appshell/src/nsAppShellService.cpp @@ -524,6 +524,8 @@ nsAppShellService::JustCreateTopWindow(nsIWebShellWindow *aParent, *aResult = nsnull; intrinsicallySized = PR_FALSE; window = new nsWebShellWindow(); + // Bump count to one so it doesn't die on us while doing init. + nsCOMPtr tempRef(window); if (!window) rv = NS_ERROR_OUT_OF_MEMORY; else {