Leak fixing. CreateNewTopLevel window returns an AddReffed window. You must release it. Also add comments to get someone to think about ownership.

This commit is contained in:
sfraser%netscape.com 1999-06-19 22:04:52 +00:00
Родитель 7ec882a272
Коммит fe65843da7
2 изменённых файлов: 5 добавлений и 8 удалений

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

@ -169,12 +169,11 @@ nsPrefMigrationProgressDialog::CreateProfileProgressDialog()
if ( NS_SUCCEEDED(rv) )
{
nsIWebShellWindow *newWindow;
nsCOMPtr<nsIWebShellWindow> newWindow;
rv = appShell->CreateTopLevelWindow( nsnull,
url,
PR_TRUE,
newWindow,
*getter_AddRefs(newWindow),
nsnull,
this, // callbacks??
0,
@ -182,9 +181,7 @@ nsPrefMigrationProgressDialog::CreateProfileProgressDialog()
if ( NS_SUCCEEDED( rv ) )
{
mWindow = newWindow;
NS_RELEASE( newWindow );
mWindow = newWindow; // ownership????
if (mWindow != nsnull)
mWindow->Show(PR_TRUE);
}

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

@ -61,7 +61,7 @@ class nsPrefMigrationProgressDialog : public nsIPrefMigrationProgress, public ns
private:
nsCOMPtr<nsIDOMXULDocument> mDocument;
nsCOMPtr<nsIWebShellWindow> mWindow;
nsCOMPtr<nsIDOMXULDocument> mDocument; // is this really owned?
nsCOMPtr<nsIWebShellWindow> mWindow; // is this really owned?
};
#endif