fix bug 21205. Make nsMacTSMMessagePump a singleton so it won't install and remove TSM AEHandler when modle dialogbox appShell create/destroy. r=pinkerton/waterson

This commit is contained in:
ftang%netscape.com 1999-12-10 20:37:50 +00:00
Родитель 14dd92d9b0
Коммит 3a6268b3b5
3 изменённых файлов: 26 добавлений и 3 удалений

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

@ -171,7 +171,7 @@ nsMacMessagePump::nsMacMessagePump(nsToolkit *aToolkit, nsMacMessageSink* aSink)
//
// create the TSM Message Pump
//
mTSMMessagePump = new nsMacTSMMessagePump();
mTSMMessagePump = nsMacTSMMessagePump::GetSingleton();
NS_ASSERTION(mTSMMessagePump!=NULL,"nsMacMessagePump::nsMacMessagePump: Unable to create TSM Message Pump.");
}
@ -192,8 +192,6 @@ nsMacMessagePump::~nsMacMessagePump()
//
// release the TSM Message Pump
//
if (mTSMMessagePump)
delete mTSMMessagePump;
}
//=================================================================

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

@ -91,6 +91,26 @@ nsMacTSMMessagePump::~nsMacTSMMessagePump()
#endif
}
//-------------------------------------------------------------------------
nsMacTSMMessagePump* nsMacTSMMessagePump::gSingleton = nsnull;
//-------------------------------------------------------------------------
nsMacTSMMessagePump* nsMacTSMMessagePump::GetSingleton()
{
if(nsnull == gSingleton)
{
gSingleton = new nsMacTSMMessagePump();
NS_ASSERTION(gSingleton!=NULL,"nsMacTSMMessagePump::GetSingleton: Unable to create TSM Message Pump.");
}
return gSingleton;
}
//-------------------------------------------------------------------------
void nsMacTSMMessagePump::Shutdown()
{
if(gSingleton) {
delete gSingleton;
gSingleton = nsnull;
}
}
//-------------------------------------------------------------------------
//

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

@ -41,6 +41,9 @@ public:
nsMacTSMMessagePump();
~nsMacTSMMessagePump();
static nsMacTSMMessagePump* GetSingleton();
void Shutdown();
private:
static pascal OSErr PositionToOffsetHandler(const AppleEvent *theAppleEvent, AppleEvent *reply, UInt32 handlerRefcon);
static pascal OSErr OffsetToPositionHandler(const AppleEvent *theAppleEvent, AppleEvent *reply, UInt32 handlerRefcon);
@ -48,6 +51,8 @@ private:
static AEEventHandlerUPP mPos2OffsetUPP;
static AEEventHandlerUPP mOffset2PosUPP;
static AEEventHandlerUPP mUpdateUPP;
static nsMacTSMMessagePump* gSingleton;
};