Bug 995893 part.2 Unregister all references to nsTextStore before releasing its instance r=jimm

This commit is contained in:
Masayuki Nakano 2014-07-12 02:09:59 +09:00
parent 4cae0ee102
commit 0e2ed4569b
2 changed files with 19 additions and 7 deletions

View File

@ -576,7 +576,14 @@ nsTextStore::Init(ITfThreadMgr* aThreadMgr)
nsTextStore::~nsTextStore()
{
PR_LOG(sTextStoreLog, PR_LOG_ALWAYS,
("TSF: 0x%p nsTextStore instance is destroyed, "
("TSF: 0x%p nsTextStore instance is destroyed", this));
}
void
nsTextStore::Shutdown()
{
PR_LOG(sTextStoreLog, PR_LOG_ALWAYS,
("TSF: 0x%p nsTextStore::Shutdown() "
"mWidget=0x%p, mDocumentMgr=0x%p, mContext=0x%p, mIPProfileCookie=0x%08X, "
"mLangProfileCookie=0x%08X",
this, mWidget.get(), mDocumentMgr.get(), mContext.get(),
@ -588,13 +595,13 @@ nsTextStore::~nsTextStore()
sTsfThreadMgr->QueryInterface(IID_ITfSource, getter_AddRefs(source));
if (FAILED(hr)) {
PR_LOG(sTextStoreLog, PR_LOG_ERROR,
("TSF: 0x%p ~nsTextStore FAILED to get ITfSource instance "
"(0x%08X)", this, hr));
("TSF: 0x%p nsTextStore::Shutdown() FAILED to get "
"ITfSource instance (0x%08X)", this, hr));
} else {
hr = source->UnadviseSink(mIPProfileCookie);
if (FAILED(hr)) {
PR_LOG(sTextStoreLog, PR_LOG_ERROR,
("TSF: 0x%p ~nsTextStore FAILED to uninstall "
("TSF: 0x%p nsTextStore::Shutdown() FAILED to uninstall "
"ITfInputProcessorProfileActivationSink (0x%08X)",
this, hr));
}
@ -607,13 +614,13 @@ nsTextStore::~nsTextStore()
sTsfThreadMgr->QueryInterface(IID_ITfSource, getter_AddRefs(source));
if (FAILED(hr)) {
PR_LOG(sTextStoreLog, PR_LOG_ERROR,
("TSF: 0x%p ~nsTextStore FAILED to get ITfSource instance "
"(0x%08X)", this, hr));
("TSF: 0x%p nsTextStore::Shutdown() FAILED to get "
"ITfSource instance (0x%08X)", this, hr));
} else {
hr = source->UnadviseSink(mLangProfileCookie);
if (FAILED(hr)) {
PR_LOG(sTextStoreLog, PR_LOG_ERROR,
("TSF: 0x%p ~nsTextStore FAILED to uninstall "
("TSF: 0x%p nsTextStore::Shutdown() FAILED to uninstall "
"ITfActiveLanguageProfileNotifySink (0x%08X)",
this, hr));
}
@ -3862,6 +3869,10 @@ nsTextStore::Terminate(void)
{
PR_LOG(sTextStoreLog, PR_LOG_ALWAYS, ("TSF: nsTextStore::Terminate()"));
if (sTsfTextStore) {
sTsfTextStore->Shutdown();
}
NS_IF_RELEASE(sDisplayAttrMgr);
NS_IF_RELEASE(sCategoryMgr);
NS_IF_RELEASE(sTsfTextStore);

View File

@ -226,6 +226,7 @@ protected:
~nsTextStore();
bool Init(ITfThreadMgr* aThreadMgr);
void Shutdown();
static void MarkContextAsKeyboardDisabled(ITfContext* aContext);
static void MarkContextAsEmpty(ITfContext* aContext);