Skip to content

Commit

Permalink
release the unique_ptr when the tab strip gives it to us so it doesn'…
Browse files Browse the repository at this point in the history
…t get destroyed prematurely
  • Loading branch information
bridiver authored and darkdh committed Aug 3, 2018
1 parent c777552 commit 81b5c1f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions atom/browser/extensions/tab_helper.cc
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ bool TabHelper::AttachGuest(int window_id, int index) {
index_ = index;
browser->tab_strip_model()->ReplaceWebContentsAt(
GetTabStripIndex(window_id, index_),
base::WrapUnique(web_contents()));
base::WrapUnique(web_contents())).release();
return true;
}
}
Expand Down Expand Up @@ -208,7 +208,7 @@ content::WebContents* TabHelper::DetachGuest() {

// Replace the detached tab with the null placeholder
browser_->tab_strip_model()->ReplaceWebContentsAt(
get_index(), std::move(null_contents));
get_index(), std::move(null_contents)).release();

return null_contents.get();
}
Expand Down Expand Up @@ -427,7 +427,7 @@ void TabHelper::SetBrowser(Browser* browser) {
if (browser_) {
if (get_index() != TabStripModel::kNoTab)
// TODO(hferreiro)
// browser_->tab_strip_model()->DetachWebContentsAt(get_index());
browser_->tab_strip_model()->DetachWebContentsAt(get_index()).release();

OnBrowserRemoved(browser_);
}
Expand Down Expand Up @@ -546,7 +546,7 @@ bool TabHelper::MoveTo(int index, int window_id, bool foreground) {
for (auto* b : *BrowserList::GetInstance()) {
if (b->session_id().id() == window_id) {
if (get_index() != TabStripModel::kNoTab)
browser()->tab_strip_model()->DetachWebContentsAt(get_index());
browser()->tab_strip_model()->DetachWebContentsAt(get_index()).release();

UpdateBrowser(b);

Expand Down

0 comments on commit 81b5c1f

Please sign in to comment.