Add some scoping {} to keep nsCOMPtrs within #ifdef code scope. This make window destruction order similar on Mac and other platforms, thereby fixing bug 38869 and maybe some other leaks.

This commit is contained in:
sfraser%netscape.com 2000-05-11 01:08:37 +00:00
parent c9c7c78bbe
commit 01bcb15814
2 changed files with 4 additions and 0 deletions

View File

@ -1710,6 +1710,7 @@ nsWebShellWindow::NotifyObservers( const nsString &aTopic, const nsString &someD
NS_IMETHODIMP nsWebShellWindow::Destroy()
{
#ifdef USE_NATIVE_MENUS
{
// unregister as document listener
// this is needed for menus
nsCOMPtr<nsIContentViewer> cv;
@ -1723,6 +1724,7 @@ NS_IMETHODIMP nsWebShellWindow::Destroy()
if(doc)
doc->RemoveObserver(NS_STATIC_CAST(nsIDocumentObserver*, this));
}
}
#endif
return nsXULWindow::Destroy();

View File

@ -370,6 +370,7 @@ NS_IMETHODIMP nsXULWindow::Destroy()
return NS_OK;
#ifdef XP_MAC // Anyone still using native menus should add themselves here.
{
// unregister as document listener
// this is needed for menus
nsCOMPtr<nsIContentViewer> cv;
@ -383,6 +384,7 @@ NS_IMETHODIMP nsXULWindow::Destroy()
/* if(doc)
doc->RemoveObserver(NS_STATIC_CAST(nsIDocumentObserver*, this)); */
}
}
#endif
nsCOMPtr<nsIAppShellService> appShell(do_GetService(kAppShellServiceCID));