From c1f4a109d41bb358c093336f0a9e51bc7fdfb93a Mon Sep 17 00:00:00 2001 From: Olli Pettay Date: Thu, 20 Sep 2012 19:13:18 +0300 Subject: [PATCH] bug 787704, better to remember addref/release sContent in IMEStateManager, r=masayuki --- content/events/src/nsIMEStateManager.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/content/events/src/nsIMEStateManager.cpp b/content/events/src/nsIMEStateManager.cpp index d8f07b240725..ad1fceb6fde9 100644 --- a/content/events/src/nsIMEStateManager.cpp +++ b/content/events/src/nsIMEStateManager.cpp @@ -61,7 +61,7 @@ nsIMEStateManager::OnDestroyPresContext(nsPresContext* aPresContext) InputContextAction::LOST_FOCUS); SetIMEState(newState, nullptr, widget, action); } - sContent = nullptr; + NS_IF_RELEASE(sContent); sPresContext = nullptr; OnTextStateBlur(nullptr, nullptr); return NS_OK; @@ -89,7 +89,7 @@ nsIMEStateManager::OnRemoveContent(nsPresContext* aPresContext, SetIMEState(newState, nullptr, widget, action); } - sContent = nullptr; + NS_IF_RELEASE(sContent); sPresContext = nullptr; return NS_OK; @@ -172,7 +172,10 @@ nsIMEStateManager::OnChangeFocusInternal(nsPresContext* aPresContext, SetIMEState(newState, aContent, widget, aAction); sPresContext = aPresContext; - sContent = aContent; + if (sContent != aContent) { + NS_IF_RELEASE(sContent); + NS_IF_ADDREF(sContent = aContent); + } return NS_OK; }