зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1359547 EventStateManager should grab IMEContentObserver with local variable before calling HandleQueryContentEvent() r=smaug
This commit is contained in:
Родитель
b05668f09b
Коммит
78a637e5f7
|
@ -912,7 +912,8 @@ EventStateManager::HandleQueryContentEvent(WidgetQueryContentEvent* aEvent)
|
|||
// If there is an IMEContentObserver, we need to handle QueryContentEvent
|
||||
// with it.
|
||||
if (mIMEContentObserver) {
|
||||
mIMEContentObserver->HandleQueryContentEvent(aEvent);
|
||||
RefPtr<IMEContentObserver> contentObserver = mIMEContentObserver;
|
||||
contentObserver->HandleQueryContentEvent(aEvent);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -549,6 +549,12 @@ IMEContentObserver::Destroy()
|
|||
}
|
||||
}
|
||||
|
||||
bool
|
||||
IMEContentObserver::Destroyed() const
|
||||
{
|
||||
return !mWidget;
|
||||
}
|
||||
|
||||
void
|
||||
IMEContentObserver::DisconnectFromEventStateManager()
|
||||
{
|
||||
|
@ -784,6 +790,16 @@ IMEContentObserver::HandleQueryContentEvent(WidgetQueryContentEvent* aEvent)
|
|||
mIsHandlingQueryContentEvent = true;
|
||||
ContentEventHandler handler(GetPresContext());
|
||||
nsresult rv = handler.HandleQueryContentEvent(aEvent);
|
||||
if (NS_WARN_IF(Destroyed())) {
|
||||
// If this has already destroyed during querying the content, the query
|
||||
// is outdated even if it's succeeded. So, make the query fail.
|
||||
aEvent->mSucceeded = false;
|
||||
MOZ_LOG(sIMECOLog, LogLevel::Warning,
|
||||
("0x%p IMEContentObserver::HandleQueryContentEvent(), WARNING, "
|
||||
"IMEContentObserver has been destroyed during the query, "
|
||||
"making the query fail", this));
|
||||
return rv;
|
||||
}
|
||||
|
||||
if (!IsInitializedWithPlugin() &&
|
||||
NS_WARN_IF(aEvent->mReply.mContentsRoot != mRootContent)) {
|
||||
|
|
|
@ -76,6 +76,8 @@ public:
|
|||
void Init(nsIWidget* aWidget, nsPresContext* aPresContext,
|
||||
nsIContent* aContent, nsIEditor* aEditor);
|
||||
void Destroy();
|
||||
bool Destroyed() const;
|
||||
|
||||
/**
|
||||
* IMEContentObserver is stored by EventStateManager during observing.
|
||||
* DisconnectFromEventStateManager() is called when EventStateManager stops
|
||||
|
|
Загрузка…
Ссылка в новой задаче