Bug 386286. Firefox.exe process running after exit, stuck in ::OleUninitialize() in OleRegisterMgr::~OleRegisterMgr(). Major work to track down the problem by Marco Zehe. r=emaijala, sr=neil, a=beltzner

This commit is contained in:
aaronleventhal@moonset.net 2007-10-31 11:55:57 -07:00
parent 16da187fab
commit 9b7e5ae7a9
2 changed files with 12 additions and 35 deletions

View File

@ -367,41 +367,6 @@ static NS_DEFINE_IID(kRenderingContextCID, NS_RENDERING_CONTEXT_CID);
static const char *sScreenManagerContractID = "@mozilla.org/gfx/screenmanager;1";
////////////////////////////////////////////////////
// Manager for Registering and unregistering OLE
// This is needed for drag & drop & Clipboard support
////////////////////////////////////////////////////
class OleRegisterMgr {
public:
~OleRegisterMgr();
protected:
OleRegisterMgr();
static OleRegisterMgr mSingleton;
};
OleRegisterMgr OleRegisterMgr::mSingleton;
OleRegisterMgr::OleRegisterMgr()
{
//DWORD dwVer = ::OleBuildVersion();
if (FAILED(::OleInitialize(NULL))) {
NS_ASSERTION(0, "***** OLE has not been initialized!\n");
} else {
#ifdef DEBUG
//printf("***** OLE has been initialized!\n");
#endif
}
}
OleRegisterMgr::~OleRegisterMgr()
{
#ifdef DEBUG
//printf("***** OLE has been Uninitialized!\n");
#endif
::OleUninitialize();
}
////////////////////////////////////////////////////
// nsWindow Class static variable definitions
////////////////////////////////////////////////////
@ -428,6 +393,7 @@ PRBool nsWindow::sIsInEndSession = PR_FALSE;
BOOL nsWindow::sIsRegistered = FALSE;
BOOL nsWindow::sIsPopupClassRegistered = FALSE;
BOOL nsWindow::sIsOleInitialized = FALSE;
UINT nsWindow::uWM_MSIME_MOUSE = 0; // mouse message for MSIME
UINT nsWindow::uWM_HEAP_DUMP = 0; // Heap Dump to a file
@ -811,6 +777,11 @@ nsWindow::nsWindow() : nsBaseWidget()
mIsTopWidgetWindow = PR_FALSE;
mLastKeyboardLayout = 0;
if (!sInstanceCount && SUCCEEDED(::OleInitialize(NULL))) {
sIsOleInitialized = TRUE;
}
NS_ASSERTION(sIsOleInitialized, "***** OLE is not initialized!\n");
sInstanceCount++;
#ifdef WINCE
@ -878,6 +849,11 @@ nsWindow::~nsWindow()
nsMemory::Free(sIMEReconvertUnicode);
NS_IF_RELEASE(gCursorImgContainer);
if (sIsOleInitialized) {
::OleUninitialize();
sIsOleInitialized = FALSE;
}
}
NS_IF_RELEASE(mNativeDragTarget);

View File

@ -470,6 +470,7 @@ protected:
static BOOL sIsRegistered;
static BOOL sIsPopupClassRegistered;
static BOOL sIsOleInitialized; // OLE is needed for clipboard and drag & drop support
HDWP mDeferredPositioner;
static UINT uWM_MSIME_MOUSE; // mouse message for MSIME