mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-03-04 15:51:37 +00:00
nsToolkit destructor was decrementing the refcount on the global event queue handler; a prelude to stopping event handling. It now does this only if it had previously incremented the refcount: a thing done in Init, not the constructor. bug 21596. r:pinkerton,scc.
This commit is contained in:
parent
03c71d0912
commit
4cbfb93c9c
@ -110,7 +110,7 @@ NS_IMPL_ISUPPORTS1(nsToolkit, nsIToolkit);
|
||||
//-------------------------------------------------------------------------
|
||||
//
|
||||
//-------------------------------------------------------------------------
|
||||
nsToolkit::nsToolkit()
|
||||
nsToolkit::nsToolkit() : mInited(false)
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
if (gEventQueueHandler == nsnull)
|
||||
@ -122,7 +122,12 @@ nsToolkit::nsToolkit()
|
||||
//-------------------------------------------------------------------------
|
||||
nsToolkit::~nsToolkit()
|
||||
{
|
||||
if (gEventQueueHandler) {
|
||||
/* StopPumping decrements a refcount on gEventQueueHandler; a prelude toward
|
||||
stopping event handling. This is not something you want to do unless you've
|
||||
bloody well started event handling and incremented the refcount. That's
|
||||
done in the Init method, not the constructor, and that's what mInited is about.
|
||||
*/
|
||||
if (mInited && gEventQueueHandler) {
|
||||
if (gEventQueueHandler->StopPumping()) {
|
||||
delete gEventQueueHandler;
|
||||
gEventQueueHandler = nsnull;
|
||||
@ -140,6 +145,7 @@ NS_IMETHODIMP nsToolkit::Init(PRThread */*aThread*/)
|
||||
{
|
||||
if (gEventQueueHandler)
|
||||
gEventQueueHandler->StartPumping();
|
||||
mInited = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -64,8 +64,11 @@ public:
|
||||
|
||||
NS_IMETHOD Init(PRThread *aThread);
|
||||
|
||||
// Appearance Mgr
|
||||
static bool HasAppearanceManager();
|
||||
// Appearance Mgr
|
||||
static bool HasAppearanceManager();
|
||||
|
||||
protected:
|
||||
bool mInited;
|
||||
};
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user