gtk: Free resources when closing window.

This commit is contained in:
Cheng Zhao 2014-04-23 12:59:03 +08:00
parent 0c9aea3308
commit 3d267fc743

View file

@ -121,10 +121,7 @@ NativeWindowGtk::NativeWindowGtk(content::WebContents* web_contents,
} }
NativeWindowGtk::~NativeWindowGtk() { NativeWindowGtk::~NativeWindowGtk() {
ui::ActiveWindowWatcherX::RemoveObserver(this); CloseImmediately();
if (window_)
gtk_widget_destroy(GTK_WIDGET(window_));
} }
void NativeWindowGtk::Close() { void NativeWindowGtk::Close() {
@ -132,7 +129,12 @@ void NativeWindowGtk::Close() {
} }
void NativeWindowGtk::CloseImmediately() { void NativeWindowGtk::CloseImmediately() {
if (window_ == NULL)
return;
NotifyWindowClosed(); NotifyWindowClosed();
ui::ActiveWindowWatcherX::RemoveObserver(this);
gtk_widget_destroy(GTK_WIDGET(window_)); gtk_widget_destroy(GTK_WIDGET(window_));
window_ = NULL; window_ = NULL;
} }