summaryrefslogtreecommitdiffstats
path: root/chrome/views
diff options
context:
space:
mode:
authorbeng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-25 20:37:28 +0000
committerbeng@google.com <beng@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-08-25 20:37:28 +0000
commit4132cc5ad7443aec1837c6501212906043ea1131 (patch)
treeb7ae1412c7ec7e67832c385f5ac532ae8ce4f6a1 /chrome/views
parent050aa8004bdacfe680417f455b8723b693f92c66 (diff)
downloadchromium_src-4132cc5ad7443aec1837c6501212906043ea1131.zip
chromium_src-4132cc5ad7443aec1837c6501212906043ea1131.tar.gz
chromium_src-4132cc5ad7443aec1837c6501212906043ea1131.tar.bz2
Second attempt at fixing task manager crash. Provide a protected ReleaseWindow methods that recycled delegates can use to release the window ptr they use. Currently only one delegate uses this (TaskManager). It'd be nice if TaskManager wasn't a singleton...
B=1333829 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@1328 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/views')
-rw-r--r--chrome/views/window_delegate.cc6
-rw-r--r--chrome/views/window_delegate.h8
2 files changed, 12 insertions, 2 deletions
diff --git a/chrome/views/window_delegate.cc b/chrome/views/window_delegate.cc
index f6021e0..c4dd3f6 100644
--- a/chrome/views/window_delegate.cc
+++ b/chrome/views/window_delegate.cc
@@ -14,7 +14,7 @@ WindowDelegate::WindowDelegate() {
}
WindowDelegate::~WindowDelegate() {
- window_.release();
+ ReleaseWindow();
}
// Returns the icon to be displayed in the window.
@@ -26,5 +26,9 @@ ClientView* WindowDelegate::CreateClientView(Window* window) {
return new ClientView(window, GetContentsView());
}
+void WindowDelegate::ReleaseWindow() {
+ window_.release();
+}
+
} // namespace ChromeViews
diff --git a/chrome/views/window_delegate.h b/chrome/views/window_delegate.h
index 204a9bf..1ab7add 100644
--- a/chrome/views/window_delegate.h
+++ b/chrome/views/window_delegate.h
@@ -124,6 +124,12 @@ class WindowDelegate {
// An accessor to the Window this delegate is bound to.
Window* window() const { return window_.get(); }
+ protected:
+ // Releases the Window* we maintain. This should be done by a delegate in its
+ // WindowClosing handler if it intends to be re-cycled to be used on a
+ // different Window.
+ void ReleaseWindow();
+
private:
friend Window;
// This is a little unusual. We use a scoped_ptr here because it's
@@ -131,7 +137,7 @@ class WindowDelegate {
// people using this helper to not have to call a ctor on this object.
// Instead we just release the owning ref this pointer has when we are
// destroyed.
- scoped_ptr<ChromeViews::Window> window_;
+ scoped_ptr<Window> window_;
};
} // namespace ChromeViews