From 305c1371400543fbb515b78e283f1571a5101968 Mon Sep 17 00:00:00 2001 From: Masayuki Nakano Date: Fri, 9 Nov 2012 17:40:39 +0900 Subject: [PATCH] Bug 806996 part.1 Remove nsTextStateManager::mDestroying r=smaug --- content/events/src/nsIMEStateManager.cpp | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/content/events/src/nsIMEStateManager.cpp b/content/events/src/nsIMEStateManager.cpp index 6c4269bffb7..adad131c7d3 100644 --- a/content/events/src/nsIMEStateManager.cpp +++ b/content/events/src/nsIMEStateManager.cpp @@ -68,7 +68,6 @@ public: nsCOMPtr mSel; nsCOMPtr mRootContent; nsCOMPtr mEditableNode; - bool mDestroying; private: void NotifyContentAdded(nsINode* aContainer, int32_t aStart, int32_t aEnd); @@ -668,7 +667,6 @@ nsIMEStateManager::NotifyIME(NotificationToIME aNotification, nsTextStateManager::nsTextStateManager() { - mDestroying = false; } nsresult @@ -755,9 +753,8 @@ bool nsTextStateManager::IsManaging(nsPresContext* aPresContext, nsIContent* aContent) { - return !mDestroying && - mEditableNode == nsIMEStateManager::GetRootEditableNode(aPresContext, - aContent); + return mEditableNode == nsIMEStateManager::GetRootEditableNode(aPresContext, + aContent); } NS_IMPL_ISUPPORTS2(nsTextStateManager, @@ -968,13 +965,13 @@ nsIMEStateManager::IsEditableIMEState(nsIWidget* aWidget) void nsIMEStateManager::DestroyTextStateManager() { - if (!sTextStateObserver || sTextStateObserver->mDestroying) { + if (!sTextStateObserver) { return; } - sTextStateObserver->mDestroying = true; - sTextStateObserver->Destroy(); - NS_RELEASE(sTextStateObserver); + nsRefPtr tsm; + tsm.swap(sTextStateObserver); + tsm->Destroy(); } void @@ -1018,10 +1015,8 @@ nsIMEStateManager::CreateTextStateManager() return; } - sTextStateObserver->mDestroying = true; - sTextStateObserver->Destroy(); - NS_RELEASE(sTextStateObserver); widget->OnIMEFocusChange(false); + DestroyTextStateManager(); } nsresult