Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(915)

Unified Diff: views/view.cc

Issue 6267013: Delay deletion of view in View::DoRemoveChildView (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: views/view.cc
diff --git a/views/view.cc b/views/view.cc
index ebbb36aa1aa4bc771a6ebb49e7eed817f814a06d..9e801ee593fbe692b313ddd4901128cdb99a15f4 100644
--- a/views/view.cc
+++ b/views/view.cc
@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "base/message_loop.h"
+#include "base/scoped_ptr.h"
#include "base/utf_string_conversions.h"
#include "gfx/canvas_skia.h"
#include "gfx/path.h"
@@ -631,6 +632,7 @@ void View::DoRemoveChildView(View* a_view,
const ViewList::iterator i = find(child_views_.begin(),
child_views_.end(),
a_view);
+ scoped_ptr<View> view_to_be_deleted;
if (i != child_views_.end()) {
if (update_focus_cycle) {
// Let's remove the view from the focus traversal.
@@ -649,7 +651,7 @@ void View::DoRemoveChildView(View* a_view,
a_view->SetParent(NULL);
if (delete_removed_view && a_view->IsParentOwned())
- delete a_view;
+ view_to_be_deleted.reset(a_view);
child_views_.erase(i);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698