From 70619021e69badc18b51f5f0def063565fadcb75 Mon Sep 17 00:00:00 2001 From: "beard%netscape.com" Date: Sat, 9 Oct 1999 03:08:56 +0000 Subject: [PATCH] fix memory leaks (nsMacMessage sink). r=pavlov, bug=15380 --- widget/src/mac/nsAppShell.cpp | 9 +++------ widget/src/mac/nsAppShell.h | 20 ++++++++------------ 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/widget/src/mac/nsAppShell.cpp b/widget/src/mac/nsAppShell.cpp index 9a18faf8d913..db8cde88bdb4 100644 --- a/widget/src/mac/nsAppShell.cpp +++ b/widget/src/mac/nsAppShell.cpp @@ -74,11 +74,9 @@ NS_IMETHODIMP nsAppShell::SetDispatchListener(nsDispatchListener* aDispatchListe NS_IMETHODIMP nsAppShell::Create(int* argc, char ** argv) { mToolKit = auto_ptr( new nsToolkit() ); - - mMacSink = new nsMacMessageSink(); - mMacPump = auto_ptr( new nsMacMessagePump(mToolKit.get(), mMacSink) ); - - return NS_OK; + mMacSink = auto_ptr( new nsMacMessageSink() ); + mMacPump = auto_ptr( new nsMacMessagePump(mToolKit.get(), mMacSink.get()) ); + return NS_OK; } //------------------------------------------------------------------------- @@ -169,7 +167,6 @@ nsAppShell::nsAppShell() } mRefCnt = 0; mExitCalled = PR_FALSE; - mMacSink = 0; } //------------------------------------------------------------------------- diff --git a/widget/src/mac/nsAppShell.h b/widget/src/mac/nsAppShell.h index 4381026d2bf0..3edc90e0d57a 100644 --- a/widget/src/mac/nsAppShell.h +++ b/widget/src/mac/nsAppShell.h @@ -39,18 +39,6 @@ class nsToolkit; class nsAppShell : public nsIAppShell { - private: - nsDispatchListener *mDispatchListener; // note: we don't own this, but it can be NULL - auto_ptr mToolKit; - auto_ptr mMacPump; - nsMacMessageSink *mMacSink; //еее this will be COM, so use scc's COM_auto_ptr - PRBool mExitCalled; - static PRBool mInitializedToolbox; - - // CLASS METHODS - private: - - public: nsAppShell(); virtual ~nsAppShell(); @@ -72,6 +60,14 @@ class nsAppShell : public nsIAppShell NS_IMETHOD DispatchNativeEvent(PRBool aRealEvent, void *aEvent); NS_IMETHOD EventIsForModalWindow(PRBool aRealEvent, void *aEvent, nsIWidget *aWidget, PRBool *aForWindow); + + private: + nsDispatchListener *mDispatchListener; // note: we don't own this, but it can be NULL + auto_ptr mToolKit; + auto_ptr mMacPump; + auto_ptr mMacSink; //еее this will be COM, so use scc's COM_auto_ptr + PRBool mExitCalled; + static PRBool mInitializedToolbox; }; #endif // nsAppShell_h__