Skip to content

Commit

Permalink
Store the result of Pass() in a local variable.
Browse files Browse the repository at this point in the history
This makes the use of Pass() similar to how std::move() would be used
to make this code act as it should when using unique_ptr.

R=sky@chromium.org
BUG=418297

Review URL: https://codereview.chromium.org/609083002

Cr-Commit-Position: refs/heads/master@{#297214}
  • Loading branch information
danakj authored and Commit bot committed Sep 29, 2014
1 parent 7d56ae7 commit 514a30a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ash/drag_drop/drag_drop_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -557,9 +557,9 @@ void DragDropController::Cleanup() {
drag_window_->RemoveObserver(this);
drag_window_ = NULL;
drag_data_ = NULL;
// Cleanup can be called again while deleting DragDropTracker, so use Pass
// instead of reset to avoid double free.
drag_drop_tracker_.Pass();
// Cleanup can be called again while deleting DragDropTracker, so delete
// the pointer with a local variable to avoid double free.
scoped_ptr<ash::DragDropTracker> holder = drag_drop_tracker_.Pass();
}

} // namespace ash

0 comments on commit 514a30a

Please sign in to comment.