-
aroben@apple.com authored
WebView will now take care of these operations itself when its last reference is released, if they haven't already been done. IWebView::close now also destroys the WebView's HWND. All WebKit clients were already performing these operations in succession anyway, or were attempting to by calling IWebView::close then destroying the WebView's host window (which actually resulted in the WebView's HWND leaking, and the crash in the below bug). Fixes <http://webkit.org/b/32827> Crash when calling IWebView::close, then releasing the WebView, without calling DestroyWindow Fixes a few WebViewDestruction tests, too. Reviewed by Steve Falkenburg. * WebView.cpp: (WebView::~WebView): Don't try to destroy m_viewWindow here. That should already have happened. Assert that this is the case. (WebView::close): If m_viewWindow isn't already being destroyed, destroy it now. Moved the call to revokeDragDrop() here from our WM_DESTROY handler because it needs to be done before m_viewWindow is nulled out. (WebView::WebViewWndProc): Removed call to revokeDragDrop() that close() now performs. (WebView::Release): If our last reference is being released, call close() so that clients don't have to. (It's harmless to call close() multiple times.) We do this here instead of in the destructor because close() can cause AddRef() and Release() to be called, and calling those from within the destructor leads to double-destruction. (WebView::setHostWindow): Removed an unnecessary (and now harmful) null-check. (WebView::revokeDragDrop): Changed an assertion into a run-time check, since this will now sometimes be called when m_viewWindow hasn't been created yet. Changed the IsWindow call to a null-check because we never hold onto a destroyed m_viewWindow. (WebView::windowAncestryDidChange): If we don't have a view window, stop tracking changes to our parent's active state. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52830 268f45cc-cd09-0410-ab3c-d52691b4dbfc
317b2687