summaryrefslogtreecommitdiffstats
path: root/views
diff options
context:
space:
mode:
authorglotov@google.com <glotov@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-12 12:12:14 +0000
committerglotov@google.com <glotov@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-05-12 12:12:14 +0000
commit0a7412cbe376c30107528c2df1d1af87661ff29a (patch)
treec746d0852c9b370c2ad51cfea810ee4838fc8fe7 /views
parent508006b0c962c36f0699c8497593054a4ea77205 (diff)
downloadchromium_src-0a7412cbe376c30107528c2df1d1af87661ff29a.zip
chromium_src-0a7412cbe376c30107528c2df1d1af87661ff29a.tar.gz
chromium_src-0a7412cbe376c30107528c2df1d1af87661ff29a.tar.bz2
Removing DeleteSoon() from WigetGtk so it behaves like WidgetWin
BUG=chromium-os:15129 TEST=tests Review URL: http://codereview.chromium.org/7002029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85120 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'views')
-rw-r--r--views/widget/widget_gtk.cc18
-rw-r--r--views/widget/widget_gtk.h4
-rw-r--r--views/window/window_gtk.cc3
-rw-r--r--views/window/window_gtk.h1
4 files changed, 17 insertions, 9 deletions
diff --git a/views/widget/widget_gtk.cc b/views/widget/widget_gtk.cc
index b506dac..5122904 100644
--- a/views/widget/widget_gtk.cc
+++ b/views/widget/widget_gtk.cc
@@ -322,6 +322,8 @@ WidgetGtk::WidgetGtk()
}
WidgetGtk::~WidgetGtk() {
+ if (!delete_on_destroy_ && widget_)
+ CloseNow();
// We need to delete the input method before calling DestroyRootView(),
// because it'll set focus_manager_ to NULL.
input_method_.reset();
@@ -900,10 +902,10 @@ void WidgetGtk::MoveAbove(gfx::NativeView native_view) {
}
void WidgetGtk::SetShape(gfx::NativeRegion region) {
- DCHECK(widget_);
- DCHECK(widget_->window);
- gdk_window_shape_combine_region(widget_->window, region, 0, 0);
- gdk_region_destroy(region);
+ if (widget_ && widget_->window) {
+ gdk_window_shape_combine_region(widget_->window, region, 0, 0);
+ gdk_region_destroy(region);
+ }
}
void WidgetGtk::Close() {
@@ -1310,11 +1312,9 @@ void WidgetGtk::OnDestroy(GtkWidget* object) {
// NULL out pointers here since we might still be in an observerer list
// until delstion happens.
widget_ = window_contents_ = NULL;
- if (delete_on_destroy_) {
- // Delays the deletion of this WidgetGtk as we want its children to have
- // access to it when destroyed.
- MessageLoop::current()->DeleteSoon(FROM_HERE, this);
- }
+ OnDestroyed();
+ if (delete_on_destroy_)
+ delete this;
}
void WidgetGtk::OnShow(GtkWidget* widget) {
diff --git a/views/widget/widget_gtk.h b/views/widget/widget_gtk.h
index eaa29cd..d60a82f 100644
--- a/views/widget/widget_gtk.h
+++ b/views/widget/widget_gtk.h
@@ -253,6 +253,10 @@ class WidgetGtk : public Widget,
CHROMEGTK_CALLBACK_0(WidgetGtk, void, OnMap);
CHROMEGTK_CALLBACK_0(WidgetGtk, void, OnHide);
+ // Invoked when the widget is destroyed and right before the object
+ // destruction. Useful for overriding.
+ virtual void OnDestroyed() { }
+
// Invoked when gtk grab is stolen by other GtkWidget in the same
// application.
virtual void HandleGtkGrabBroke();
diff --git a/views/window/window_gtk.cc b/views/window/window_gtk.cc
index 0e7a6f2..d55d657 100644
--- a/views/window/window_gtk.cc
+++ b/views/window/window_gtk.cc
@@ -443,6 +443,9 @@ void WindowGtk::SaveWindowPosition() {
void WindowGtk::OnDestroy(GtkWidget* widget) {
delegate_->OnNativeWindowDestroying();
WidgetGtk::OnDestroy(widget);
+}
+
+void WindowGtk::OnDestroyed() {
delegate_->OnNativeWindowDestroyed();
}
diff --git a/views/window/window_gtk.h b/views/window/window_gtk.h
index e659e4a..72782a5 100644
--- a/views/window/window_gtk.h
+++ b/views/window/window_gtk.h
@@ -91,6 +91,7 @@ class WindowGtk : public WidgetGtk, public NativeWindow, public Window {
friend class Window;
virtual void OnDestroy(GtkWidget* widget);
+ virtual void OnDestroyed();
private:
static gboolean CallConfigureEvent(GtkWidget* widget,