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

Unified Diff: chrome/browser/webshare/share_service_impl.cc

Issue 2688413006: Fixed crash if tab closes while WebShare picker dialog is open. (Closed)
Patch Set: Do Sam's suggestions. Created 3 years, 10 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
Index: chrome/browser/webshare/share_service_impl.cc
diff --git a/chrome/browser/webshare/share_service_impl.cc b/chrome/browser/webshare/share_service_impl.cc
index 281a082040090daaa4e4e2d46c6ce8d4dc2d0fba..608707fcad5e188c7de11184f939b3d31d3d453a 100644
--- a/chrome/browser/webshare/share_service_impl.cc
+++ b/chrome/browser/webshare/share_service_impl.cc
@@ -48,7 +48,7 @@ std::string JoinString(const std::vector<base::StringPiece>& pieces) {
} // namespace
-ShareServiceImpl::ShareServiceImpl() = default;
+ShareServiceImpl::ShareServiceImpl() : weak_factory_(this) {}
ShareServiceImpl::~ShareServiceImpl() = default;
// static
@@ -203,7 +203,7 @@ void ShareServiceImpl::Share(const std::string& title,
ShowPickerDialog(
sufficiently_engaged_targets,
- base::Bind(&ShareServiceImpl::OnPickerClosed, base::Unretained(this),
+ base::Bind(&ShareServiceImpl::OnPickerClosed, weak_factory_.GetWeakPtr(),
base::Passed(&share_targets), title, text, share_url,
callback));
}
« no previous file with comments | « chrome/browser/webshare/share_service_impl.h ('k') | chrome/browser/webshare/share_service_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698