Commit ea6ebc2c authored by kinaba@chromium.org's avatar kinaba@chromium.org

Fix a memory leak in the IME candidate window of Chrome OS (2nd try).

TEST=Observed the leak and its remediation by inserting debug counter for CandidateView constructor/destructor. Verified no crash to happen by (1.Focus Omnibox 2.Enable Japanese IME 3.type "henkan" and press space key two times 4.press enter 5.type "a").
BUG=chromium-os:18893

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98931 0039d316-1c4b-4281-b951-d872f2087c98
parent 29a61082
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/scoped_ptr.h" #include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "base/string_util.h" #include "base/string_util.h"
#include "base/stringprintf.h" #include "base/stringprintf.h"
...@@ -1048,6 +1049,8 @@ void CandidateWindowView::MaybeInitializeCandidateViews( ...@@ -1048,6 +1049,8 @@ void CandidateWindowView::MaybeInitializeCandidateViews(
// Clear the existing candidate_views if any. // Clear the existing candidate_views if any.
for (size_t i = 0; i < candidate_views_.size(); ++i) { for (size_t i = 0; i < candidate_views_.size(); ++i) {
candidate_area_contents->RemoveChildView(candidate_views_[i]); candidate_area_contents->RemoveChildView(candidate_views_[i]);
// Delete the view after getting out the current message loop iteration.
MessageLoop::current()->DeleteSoon(FROM_HERE, candidate_views_[i]);
} }
candidate_views_.clear(); candidate_views_.clear();
......
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