summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-21 20:24:09 +0000
committersky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-21 20:24:09 +0000
commit21ba9918905c5f3f66e3a075944587618da2d52d (patch)
treedd74335c8b26a342779523dd5ae0a6e2c36195c8
parent8a0fde3153aeebbed4512fbae5d586b33490f1ab (diff)
downloadchromium_src-21ba9918905c5f3f66e3a075944587618da2d52d.zip
chromium_src-21ba9918905c5f3f66e3a075944587618da2d52d.tar.gz
chromium_src-21ba9918905c5f3f66e3a075944587618da2d52d.tar.bz2
Fixes possible crash in creating Browser. The crash could happen
because its possible for the browserwindow to be null when SaveWindowPlacement is invoked (when the browserwindow is initially created). If the SessionService ends up asking the browser for the browserwindow it would get null and crash. BUG=4666 TEST=no direct way to test this as its rather random. But make sure you don't encounter any problems with session restore. Review URL: http://codereview.chromium.org/11567 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5844 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/browser.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc
index 375f566..262bc44 100644
--- a/chrome/browser/browser.cc
+++ b/chrome/browser/browser.cc
@@ -324,6 +324,11 @@ 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