diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-16 21:30:07 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-16 21:30:07 +0000 |
commit | f41301e22f97b5117f8b6ada563d7916b01fe56c (patch) | |
tree | 5fb1ecea7b16d71c740a44651b8588b500b9ad77 /chrome/browser/spellcheck_host.cc | |
parent | 92b004f5485530d81daab60b5b02207507d1a2bd (diff) | |
download | chromium_src-f41301e22f97b5117f8b6ada563d7916b01fe56c.zip chromium_src-f41301e22f97b5117f8b6ada563d7916b01fe56c.tar.gz chromium_src-f41301e22f97b5117f8b6ada563d7916b01fe56c.tar.bz2 |
Spellchecker: call init *after* constructor.
This fixes the error where PostTask would post the task to the file thread and release its reference before the constructor returned.
credit for fix goes to jam@ and thestig@
Review URL: http://codereview.chromium.org/399011
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@32089 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/spellcheck_host.cc')
-rw-r--r-- | chrome/browser/spellcheck_host.cc | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/chrome/browser/spellcheck_host.cc b/chrome/browser/spellcheck_host.cc index c9fea3ecf..6e77e19 100644 --- a/chrome/browser/spellcheck_host.cc +++ b/chrome/browser/spellcheck_host.cc @@ -144,9 +144,6 @@ SpellCheckHost::SpellCheckHost(Observer* observer, PathService::Get(chrome::DIR_USER_DATA, &personal_file_directory); custom_dictionary_file_ = personal_file_directory.Append(chrome::kCustomDictionaryFileName); - - ChromeThread::PostTask(ChromeThread::FILE, FROM_HERE, - NewRunnableMethod(this, &SpellCheckHost::Initialize)); } SpellCheckHost::~SpellCheckHost() { @@ -154,6 +151,11 @@ SpellCheckHost::~SpellCheckHost() { close(fd_.fd); } +void SpellCheckHost::Initialize() { + ChromeThread::PostTask(ChromeThread::FILE, FROM_HERE, + NewRunnableMethod(this, &SpellCheckHost::InitializeInternal)); +} + void SpellCheckHost::UnsetObserver() { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI)); @@ -172,7 +174,7 @@ void SpellCheckHost::AddWord(const std::string& word) { Source<SpellCheckHost>(this), NotificationService::NoDetails()); } -void SpellCheckHost::Initialize() { +void SpellCheckHost::InitializeInternal() { DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE)); if (!observer_) |