mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
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:
parent
14dd92d9b0
commit
3a6268b3b5
@ -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;
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user