Correctly handle window's lifetime when it's closed.

This commit is contained in:
Cheng Zhao 2013-05-01 23:28:01 +08:00
parent 9e489cae0c
commit afe07521c5
7 changed files with 23 additions and 8 deletions

View file

@ -37,6 +37,7 @@
}
- (void)windowWillClose:(NSNotification *)notification {
shell_->window() = nil;
[self autorelease];
}
@ -114,6 +115,8 @@ NativeWindowMac::NativeWindowMac(content::WebContents* web_contents,
}
NativeWindowMac::~NativeWindowMac() {
if (window())
[window() release];
}
void NativeWindowMac::Close() {
@ -121,6 +124,7 @@ void NativeWindowMac::Close() {
}
void NativeWindowMac::CloseImmediately() {
[window() orderOut:nil];
[window() close];
}