diff --git a/mozilla/widget/src/mac/nsAppShell.cpp b/mozilla/widget/src/mac/nsAppShell.cpp index 16b7515832d..cb57750227a 100644 --- a/mozilla/widget/src/mac/nsAppShell.cpp +++ b/mozilla/widget/src/mac/nsAppShell.cpp @@ -18,11 +18,13 @@ #include "nsAppShell.h" #include "nsIAppShell.h" -#include "nsWindow.h" -#include -#include "nsMacMessagePump.h" -//XtAppContext gAppContext; +#include "nsMacMessageSink.h" //еее until this is moved into XP +#include "nsMacMessagePump.h" +#include "nsToolKit.h" + +#include + //------------------------------------------------------------------------- // @@ -46,7 +48,7 @@ NS_IMETHODIMP nsAppShell::SetDispatchListener(nsDispatchListener* aDispatchListe NS_IMETHODIMP nsAppShell::Create(int* argc, char ** argv) { - mToolKit = new nsToolkit(); + mToolKit = auto_ptr( new nsToolkit() ); return NS_OK; } @@ -57,12 +59,10 @@ NS_IMETHODIMP nsAppShell::Create(int* argc, char ** argv) //------------------------------------------------------------------------- nsresult nsAppShell::Run() { - mMacPump = new nsMacMessagePump(mToolKit); + mMacSink = new nsMacMessageSink(); + mMacPump = auto_ptr( new nsMacMessagePump(mToolKit.get(), mMacSink) ); mMacPump->DoMessagePump(); - delete mMacPump; - mMacPump = nsnull; - //if (mDispatchListener) //mDispatchListener->AfterDispatch(); @@ -83,7 +83,7 @@ nsresult nsAppShell::Run() //------------------------------------------------------------------------- NS_IMETHODIMP nsAppShell::Exit() { - if (mMacPump) + if (mMacPump.get()) { mMacPump->StopRunning(); @@ -104,8 +104,6 @@ NS_IMETHODIMP nsAppShell::Exit() nsAppShell::nsAppShell() { mRefCnt = 0; - mDispatchListener = 0; - mMacPump = nsnull; mExitCalled = PR_FALSE; } diff --git a/mozilla/widget/src/mac/nsAppShell.h b/mozilla/widget/src/mac/nsAppShell.h index 2525465619e..4e0d6ed4aaf 100644 --- a/mozilla/widget/src/mac/nsAppShell.h +++ b/mozilla/widget/src/mac/nsAppShell.h @@ -20,8 +20,6 @@ #define nsAppShell_h__ #include "nsIAppShell.h" -#include "nsMacMessagePump.h" -#include "nsToolKit.h" #include #include #include @@ -29,6 +27,11 @@ #include #include +#include + +class nsMacMessagePump; +class nsMacMessageSink; +class nsToolkit; /** * Native MAC Application shell wrapper @@ -37,10 +40,11 @@ class nsAppShell : public nsIAppShell { private: - nsDispatchListener *mDispatchListener; - nsToolkit *mToolKit; - nsMacMessagePump *mMacPump; - PRBool mExitCalled; + nsDispatchListener *mDispatchListener; + auto_ptr mToolKit; + auto_ptr mMacPump; + nsMacMessageSink *mMacSink; //еее this will be COM, so use scc's COM_auto_ptr + PRBool mExitCalled; // CLASS METHODS private: