Make it safe to call IWebView::close when IWebView::initWithFrame hasn't been called
authoraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Jan 2010 23:07:21 +0000 (23:07 +0000)
committeraroben@apple.com <aroben@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 5 Jan 2010 23:07:21 +0000 (23:07 +0000)
commit7ba5d78d66ffd71b9725c712083b6d66fa38354b
tree36b5058ec25065cbec26e56ff73639d1e5d1c5c9
parenta9621beab61fdd9e7beadf29e06da1cbf4dfc286
Make it safe to call IWebView::close when IWebView::initWithFrame hasn't been called

Part of <http://webkit.org/b/32827> Crash when calling
IWebView::close, then releasing the WebView, without calling
DestroyWindow

Reviewed by Steve Falkenburg.

WebKit/win:

* WebView.cpp:
(WebView::close): Null-check m_page and m_preferences before using
them. They will be null if initWithFrame was never called.

WebKitTools:

Test that it's safe to call IWebView::close when IWebView::initWithFrame
hasn't been called

* WebKitAPITest/tests/WebViewDestruction.cpp:
(WebKitAPITest::CloseWithoutInitWithFrame): Calls IWebView::close
without ever calling IWebView::initWithFrame and tests that we don't
crash or leak.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@52829 268f45cc-cd09-0410-ab3c-d52691b4dbfc
WebKit/win/ChangeLog
WebKit/win/WebView.cpp
WebKitTools/ChangeLog
WebKitTools/WebKitAPITest/tests/WebViewDestruction.cpp