Commit 908e349c authored by zork@chromium.org's avatar zork@chromium.org

Prevent initialization of the Input Method Manager after the APP_TERMINATING message has been sent.


R=derat@chromium.org
BUG=chromium-os:12402
TEST=None


Review URL: http://codereview.chromium.org/7747015

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98404 0039d316-1c4b-4281-b951-d872f2087c98
parent 5fd82d91
...@@ -75,6 +75,7 @@ class InputMethodManagerImpl : public InputMethodManager, ...@@ -75,6 +75,7 @@ class InputMethodManagerImpl : public InputMethodManager,
#if !defined(TOUCH_UI) #if !defined(TOUCH_UI)
candidate_window_controller_(NULL), candidate_window_controller_(NULL),
#endif #endif
shutting_down_(false),
ibus_daemon_process_handle_(base::kNullProcessHandle) { ibus_daemon_process_handle_(base::kNullProcessHandle) {
// Observe APP_TERMINATING to stop input method daemon gracefully. // Observe APP_TERMINATING to stop input method daemon gracefully.
// We should not use APP_EXITING here since logout might be canceled by // We should not use APP_EXITING here since logout might be canceled by
...@@ -832,6 +833,11 @@ class InputMethodManagerImpl : public InputMethodManager, ...@@ -832,6 +833,11 @@ class InputMethodManagerImpl : public InputMethodManager,
return false; return false;
} }
if (shutting_down_) {
NOTREACHED() << "Trying to launch input method while shutting down";
return false;
}
#if !defined(TOUCH_UI) #if !defined(TOUCH_UI)
if (!candidate_window_controller_.get()) { if (!candidate_window_controller_.get()) {
candidate_window_controller_.reset( candidate_window_controller_.reset(
...@@ -904,6 +910,7 @@ class InputMethodManagerImpl : public InputMethodManager, ...@@ -904,6 +910,7 @@ class InputMethodManagerImpl : public InputMethodManager,
const NotificationDetails& details) { const NotificationDetails& details) {
// Stop the input method daemon on browser shutdown. // Stop the input method daemon on browser shutdown.
if (type == content::NOTIFICATION_APP_TERMINATING) { if (type == content::NOTIFICATION_APP_TERMINATING) {
shutting_down_ = true;
notification_registrar_.RemoveAll(); notification_registrar_.RemoveAll();
StopInputMethodDaemon(); StopInputMethodDaemon();
#if !defined(TOUCH_UI) #if !defined(TOUCH_UI)
...@@ -966,6 +973,9 @@ class InputMethodManagerImpl : public InputMethodManager, ...@@ -966,6 +973,9 @@ class InputMethodManagerImpl : public InputMethodManager,
candidate_window_controller_; candidate_window_controller_;
#endif #endif
// True if we've received the APP_TERMINATING notification.
bool shutting_down_;
// The process handle of the IBus daemon. kNullProcessHandle if it's not // The process handle of the IBus daemon. kNullProcessHandle if it's not
// running. // running.
base::ProcessHandle ibus_daemon_process_handle_; base::ProcessHandle ibus_daemon_process_handle_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment