зеркало из https://github.com/mozilla/pjs.git
Leak fixing. CreateNewTopLevel window returns an AddReffed window. You must release it.
This commit is contained in:
Родитель
769cca6398
Коммит
437a0b1c9d
|
@ -195,12 +195,12 @@ int main(int argc, char *argv[])
|
|||
/*
|
||||
* Create the Application Shell instance...
|
||||
*/
|
||||
nsIWebShellWindow* newWindow;
|
||||
nsCOMPtr<nsIWebShellWindow> newWindow;
|
||||
rv = nsServiceManager::GetService(kAppShellServiceCID,
|
||||
kIAppShellServiceIID,
|
||||
(nsISupports**)&appShell);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
appShell->CreateTopLevelWindow(nsnull, nsnull, PR_TRUE, newWindow,
|
||||
appShell->CreateTopLevelWindow(nsnull, nsnull, PR_TRUE, *getter_AddRefs(newWindow),
|
||||
nsnull, nsnull, 200, 200);
|
||||
|
||||
// Create the Event Queue for this thread...
|
||||
|
|
|
@ -132,12 +132,12 @@ int main(int argc, char *argv[])
|
|||
/*
|
||||
* Create the Application Shell instance...
|
||||
*/
|
||||
nsIWebShellWindow* newWindow;
|
||||
nsCOMPtr<nsIWebShellWindow> newWindow;
|
||||
rv = nsServiceManager::GetService(kAppShellServiceCID,
|
||||
kIAppShellServiceIID,
|
||||
(nsISupports**)&appShell);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
appShell->CreateTopLevelWindow(nsnull, nsnull, PR_TRUE, newWindow,
|
||||
appShell->CreateTopLevelWindow(nsnull, nsnull, PR_TRUE, *getter_AddRefs(newWindow),
|
||||
nsnull, nsnull, 200, 200);
|
||||
|
||||
// Create the Event Queue for this thread...
|
||||
|
|
|
@ -185,9 +185,6 @@ NS_IMETHODIMP
|
|||
nsToolkitCore::ShowWindow(const nsString& aUrl, nsIDOMWindow* aParent) {
|
||||
|
||||
nsresult rv;
|
||||
nsIWebShellWindow *window;
|
||||
|
||||
window = nsnull;
|
||||
|
||||
nsCOMPtr<nsIURL> urlObj;
|
||||
|
||||
|
@ -214,10 +211,11 @@ nsToolkitCore::ShowWindow(const nsString& aUrl, nsIDOMWindow* aParent) {
|
|||
|
||||
nsCOMPtr<nsIWebShellWindow> parent;
|
||||
DOMWindowToWebShellWindow(aParent, &parent);
|
||||
appShell->CreateTopLevelWindow(parent, urlObj, PR_TRUE, window,
|
||||
nsCOMPtr<nsIWebShellWindow> window;
|
||||
appShell->CreateTopLevelWindow(parent, urlObj, PR_TRUE, *getter_AddRefs(window),
|
||||
nsnull, nsnull, 615, 480);
|
||||
|
||||
if (window != nsnull)
|
||||
if (window)
|
||||
window->Show(PR_TRUE);
|
||||
|
||||
return rv;
|
||||
|
@ -310,9 +308,6 @@ nsToolkitCore::ShowWindowWithArgs(const nsString& aUrl,
|
|||
const nsString& aArgs) {
|
||||
|
||||
nsresult rv;
|
||||
nsIWebShellWindow *window;
|
||||
|
||||
window = nsnull;
|
||||
|
||||
nsCOMPtr<nsIURL> urlObj;
|
||||
#ifndef NECKO
|
||||
|
@ -340,10 +335,12 @@ nsToolkitCore::ShowWindowWithArgs(const nsString& aUrl,
|
|||
DOMWindowToWebShellWindow(aParent, &parent);
|
||||
nsCOMPtr<nsArgCallbacks> cb;
|
||||
cb = nsDontQueryInterface<nsArgCallbacks>( new nsArgCallbacks( aArgs ) );
|
||||
appShell->CreateTopLevelWindow(parent, urlObj, PR_TRUE, window,
|
||||
|
||||
nsCOMPtr<nsIWebShellWindow> window;
|
||||
appShell->CreateTopLevelWindow(parent, urlObj, PR_TRUE, *getter_AddRefs(window),
|
||||
nsnull, cb, 615, 650);
|
||||
|
||||
if (window != nsnull)
|
||||
if (window)
|
||||
window->Show(PR_TRUE);
|
||||
|
||||
return rv;
|
||||
|
|
|
@ -202,7 +202,7 @@ nsUnknownContentTypeHandler::HandleUnknownContentType( nsIURL *aURL,
|
|||
// Make sure we've been initialized.
|
||||
if ( mAppShell ) {
|
||||
// Open "Unknown file type" dialog.
|
||||
nsIWebShellWindow *newWindow;
|
||||
nsCOMPtr<nsIWebShellWindow> newWindow;
|
||||
|
||||
// Make url for dialog xul.
|
||||
nsIURL *url;
|
||||
|
@ -228,7 +228,7 @@ nsUnknownContentTypeHandler::HandleUnknownContentType( nsIURL *aURL,
|
|||
rv = mAppShell->CreateTopLevelWindow( nsnull,
|
||||
url,
|
||||
PR_TRUE,
|
||||
newWindow,
|
||||
*getter_AddRefs(newWindow),
|
||||
nsnull,
|
||||
dialog,
|
||||
0, 0 );
|
||||
|
@ -247,7 +247,7 @@ nsUnknownContentTypeHandler::HandleUnknownContentType( nsIURL *aURL,
|
|||
return rv;
|
||||
}
|
||||
|
||||
#ifdef NS_DEBUG
|
||||
#if defined( NS_DEBUG ) && !defined( XP_MAC )
|
||||
#define DEBUG_PRINTF PR_fprintf
|
||||
#else
|
||||
#define DEBUG_PRINTF (void)
|
||||
|
|
Загрузка…
Ссылка в новой задаче