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

Unified Diff: chrome/browser/sessions/session_service.cc

Issue 500143002: Fixes possible use after free in SessionService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove friend Created 6 years, 4 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 | « chrome/browser/sessions/session_service.h ('k') | chrome/browser/sessions/session_service_test_helper.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sessions/session_service.cc
diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc
index 7b36c75f8efd9c0ec30384b0a6491f74536022c3..0a0ac5a6c65288e31cfe8a539c92e909cc807a2e 100644
--- a/chrome/browser/sessions/session_service.cc
+++ b/chrome/browser/sessions/session_service.cc
@@ -234,7 +234,8 @@ SessionService::SessionService(Profile* profile)
save_delay_in_millis_(base::TimeDelta::FromMilliseconds(2500)),
save_delay_in_mins_(base::TimeDelta::FromMinutes(10)),
save_delay_in_hrs_(base::TimeDelta::FromHours(8)),
- force_browser_not_alive_with_no_windows_(false) {
+ force_browser_not_alive_with_no_windows_(false),
+ weak_factory_(this) {
Init();
}
@@ -245,7 +246,8 @@ SessionService::SessionService(const base::FilePath& save_path)
save_delay_in_millis_(base::TimeDelta::FromMilliseconds(2500)),
save_delay_in_mins_(base::TimeDelta::FromMinutes(10)),
save_delay_in_hrs_(base::TimeDelta::FromHours(8)),
- force_browser_not_alive_with_no_windows_(false) {
+ force_browser_not_alive_with_no_windows_(false),
+ weak_factory_(this) {
Init();
}
@@ -571,7 +573,7 @@ base::CancelableTaskTracker::TaskId SessionService::GetLastSession(
// the callback.
return ScheduleGetLastSessionCommands(
base::Bind(&SessionService::OnGotSessionCommands,
- base::Unretained(this), callback),
+ weak_factory_.GetWeakPtr(), callback),
tracker);
}
« no previous file with comments | « chrome/browser/sessions/session_service.h ('k') | chrome/browser/sessions/session_service_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698