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

This commit is contained in:
tbogard%aol.net 2000-02-08 20:19:00 +00:00
Родитель 44e45cd95f
Коммит 1b2e88bca7
1 изменённых файлов: 2 добавлений и 0 удалений

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

@ -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<nsIXULWindow> tempRef(window);
if (!window)
rv = NS_ERROR_OUT_OF_MEMORY;
else {