зеркало из https://github.com/mozilla/pjs.git
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:
Родитель
44e45cd95f
Коммит
1b2e88bca7
|
@ -524,6 +524,8 @@ nsAppShellService::JustCreateTopWindow(nsIWebShellWindow *aParent,
|
||||||
*aResult = nsnull;
|
*aResult = nsnull;
|
||||||
intrinsicallySized = PR_FALSE;
|
intrinsicallySized = PR_FALSE;
|
||||||
window = new nsWebShellWindow();
|
window = new nsWebShellWindow();
|
||||||
|
// Bump count to one so it doesn't die on us while doing init.
|
||||||
|
nsCOMPtr<nsIXULWindow> tempRef(window);
|
||||||
if (!window)
|
if (!window)
|
||||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||||
else {
|
else {
|
||||||
|
|
Загрузка…
Ссылка в новой задаче