Index: chrome/browser/ui/gtk/extensions/native_app_window_gtk.cc |
diff --git a/chrome/browser/ui/gtk/extensions/native_app_window_gtk.cc b/chrome/browser/ui/gtk/extensions/native_app_window_gtk.cc |
index 506a0826d420365e0f187866ca8a233e36c4e753..3304dc82bf884b9f45b17347237bb96ef454f728 100644 |
--- a/chrome/browser/ui/gtk/extensions/native_app_window_gtk.cc |
+++ b/chrome/browser/ui/gtk/extensions/native_app_window_gtk.cc |
@@ -4,6 +4,7 @@ |
#include "chrome/browser/ui/gtk/extensions/native_app_window_gtk.h" |
+#include "base/message_loop.h" |
#include "base/utf_string_conversions.h" |
#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/ui/gtk/extensions/extension_keybinding_registry_gtk.h" |
@@ -182,12 +183,15 @@ void NativeAppWindowGtk::Close() { |
// To help catch bugs in any event handlers that might get fired during the |
// destruction, set window_ to NULL before any handlers will run. |
window_ = NULL; |
- |
- // OnNativeClose does a delete this so no other members should |
- // be accessed after. gtk_widget_destroy is safe (and must |
- // be last). |
- shell_window_->OnNativeClose(); |
gtk_widget_destroy(window); |
+ |
+ // On other platforms, the native window doesn't get destroyed synchronously. |
+ // We simulate that here so that ShellWindow can assume that it doesn't get |
+ // deleted immediately upon calling Close(). |
+ MessageLoop::current()->PostTask( |
+ FROM_HERE, |
+ base::Bind(&ShellWindow::OnNativeClose, |
+ base::Unretained(shell_window_))); |
} |
void NativeAppWindowGtk::Activate() { |