summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/browser.cc5
-rw-r--r--chrome/browser/session_service.cc9
2 files changed, 8 insertions, 6 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 262bc44..375f566 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -324,11 +324,6 @@ bool Browser::ShouldSaveWindowPlacement() const {
}
void Browser::SaveWindowPlacement(const gfx::Rect& bounds, bool maximized) {
- if (!window_) {
- // It is possible for this to be invoked during construction of the window,
- // in which case window_ is NULL.
- return;
- }
// Save to the session storage service, used when reloading a past session.
// Note that we don't want to be the ones who cause lazy initialization of
// the session service. This function gets called during initial window
diff --git a/chrome/browser/session_service.cc b/chrome/browser/session_service.cc
index f5e042e..fa11168 100644
--- a/chrome/browser/session_service.cc
+++ b/chrome/browser/session_service.cc
@@ -1119,7 +1119,14 @@ void SessionService::BuildCommandsFromBrowsers(
DCHECK(commands);
for (BrowserList::const_iterator i = BrowserList::begin();
i != BrowserList::end(); ++i) {
- if (should_track_changes_for_browser_type((*i)->type())) {
+ // Make sure the browser has tabs and a window. Browsers destructor
+ // removes itself from the BrowserList. When a browser is closed the
+ // destructor is not necessarily run immediately. This means its possible
+ // for us to get a handle to a browser that is about to be removed. If
+ // the tab count is 0 or the window is NULL, the browser is about to be
+ // deleted, so we ignore it.
+ if (should_track_changes_for_browser_type((*i)->type()) &&
+ (*i)->tab_count() && (*i)->window()) {
BuildCommandsForBrowser(*i, commands, tab_to_available_range,
windows_to_track);
}