Bug 806996 part.1 Remove nsTextStateManager::mDestroying r=smaug

This commit is contained in:
Masayuki Nakano 2012-11-09 17:40:39 +09:00
parent 70d8b5a29b
commit 305c137140

View File

@ -68,7 +68,6 @@ public:
nsCOMPtr<nsISelection> mSel; nsCOMPtr<nsISelection> mSel;
nsCOMPtr<nsIContent> mRootContent; nsCOMPtr<nsIContent> mRootContent;
nsCOMPtr<nsINode> mEditableNode; nsCOMPtr<nsINode> mEditableNode;
bool mDestroying;
private: private:
void NotifyContentAdded(nsINode* aContainer, int32_t aStart, int32_t aEnd); void NotifyContentAdded(nsINode* aContainer, int32_t aStart, int32_t aEnd);
@ -668,7 +667,6 @@ nsIMEStateManager::NotifyIME(NotificationToIME aNotification,
nsTextStateManager::nsTextStateManager() nsTextStateManager::nsTextStateManager()
{ {
mDestroying = false;
} }
nsresult nsresult
@ -755,9 +753,8 @@ bool
nsTextStateManager::IsManaging(nsPresContext* aPresContext, nsTextStateManager::IsManaging(nsPresContext* aPresContext,
nsIContent* aContent) nsIContent* aContent)
{ {
return !mDestroying && return mEditableNode == nsIMEStateManager::GetRootEditableNode(aPresContext,
mEditableNode == nsIMEStateManager::GetRootEditableNode(aPresContext, aContent);
aContent);
} }
NS_IMPL_ISUPPORTS2(nsTextStateManager, NS_IMPL_ISUPPORTS2(nsTextStateManager,
@ -968,13 +965,13 @@ nsIMEStateManager::IsEditableIMEState(nsIWidget* aWidget)
void void
nsIMEStateManager::DestroyTextStateManager() nsIMEStateManager::DestroyTextStateManager()
{ {
if (!sTextStateObserver || sTextStateObserver->mDestroying) { if (!sTextStateObserver) {
return; return;
} }
sTextStateObserver->mDestroying = true; nsRefPtr<nsTextStateManager> tsm;
sTextStateObserver->Destroy(); tsm.swap(sTextStateObserver);
NS_RELEASE(sTextStateObserver); tsm->Destroy();
} }
void void
@ -1018,10 +1015,8 @@ nsIMEStateManager::CreateTextStateManager()
return; return;
} }
sTextStateObserver->mDestroying = true;
sTextStateObserver->Destroy();
NS_RELEASE(sTextStateObserver);
widget->OnIMEFocusChange(false); widget->OnIMEFocusChange(false);
DestroyTextStateManager();
} }
nsresult nsresult