Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Commit

Permalink
release unique_ptr to avoid double delete
Browse files Browse the repository at this point in the history
  • Loading branch information
bridiver committed Aug 8, 2018
1 parent dddf8d5 commit 25f50e6
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions brave/browser/resource_coordinator/guest_tab_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,11 @@ std::unique_ptr<WebContents> GuestTabManager::CreateNullContents(
}

void GuestTabManager::DestroyOldContents(
std::unique_ptr<WebContents> old_contents) {
std::unique_ptr<WebContents> old_contents_deleter) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);

auto tab_helper = extensions::TabHelper::FromWebContents(old_contents.get());
auto old_contents = old_contents_deleter.release();
auto tab_helper = extensions::TabHelper::FromWebContents(old_contents);
DCHECK(tab_helper && tab_helper->guest());
// Let the guest destroy itself after the detach message has been received
tab_helper->guest()->SetCanRunInDetachedState(false);
Expand Down

1 comment on commit 25f50e6

@darkdh
Copy link
Member

@darkdh darkdh commented on 25f50e6 Aug 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

Please sign in to comment.