From b82d09c2891542809790785d4b5dbe563420d5ee Mon Sep 17 00:00:00 2001 From: "ananta@chromium.org" Date: Mon, 26 Apr 2010 06:04:02 +0000 Subject: Some more chrome frame test pure virtual function call crash fixes. There is another crash which occurs when the remote COM apartment running in Ie shuts down and tries to free references to the web browser event sink. We unsubscribe from the event sink in the destructor of the ComStackObjectWithUninitialize object. The call to DispEventUnadvise fails every time. Unsubscribing and call CoDisconnectObject to release the server side stub references in the OnQuit notification fixes the crash. To aid debugging this issue in the future we now override the purecall handler in chrome frame tests. Bug=41980 TBR=amit Review URL: http://codereview.chromium.org/1695015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@45569 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome_frame/test/chrome_frame_test_utils.cc | 5 ++++- chrome_frame/test/chrome_frame_test_utils.h | 6 +++++- chrome_frame/test/run_all_unittests.cc | 6 ++++++ 3 files changed, 15 insertions(+), 2 deletions(-) (limited to 'chrome_frame') diff --git a/chrome_frame/test/chrome_frame_test_utils.cc b/chrome_frame/test/chrome_frame_test_utils.cc index a174a6b..1cc1f47 100644 --- a/chrome_frame/test/chrome_frame_test_utils.cc +++ b/chrome_frame/test/chrome_frame_test_utils.cc @@ -449,7 +449,10 @@ void WebBrowserEventSink::Attach(IDispatch* browser_disp) { void WebBrowserEventSink::Uninitialize() { DisconnectFromChromeFrame(); if (web_browser2_.get()) { - DispEventUnadvise(web_browser2_); + if (m_dwEventCookie != 0xFEFEFEFE) { + CoDisconnectObject(this, 0); + DispEventUnadvise(web_browser2_); + } ScopedHandle process; // process_id_to_wait_for_ is set when we receive OnQuit. diff --git a/chrome_frame/test/chrome_frame_test_utils.h b/chrome_frame/test/chrome_frame_test_utils.h index b7a3908..5a4e841 100644 --- a/chrome_frame/test/chrome_frame_test_utils.h +++ b/chrome_frame/test/chrome_frame_test_utils.h @@ -135,7 +135,8 @@ class WebBrowserEventSink : public CComObjectRootEx, public IDispEventSimpleImpl<0, WebBrowserEventSink, &DIID_DWebBrowserEvents2>, - public WindowObserver { + public WindowObserver, + public IUnknown { public: typedef IDispEventSimpleImpl<0, WebBrowserEventSink, &DIID_DWebBrowserEvents2> DispEventsImpl; @@ -155,6 +156,7 @@ class WebBrowserEventSink } BEGIN_COM_MAP(WebBrowserEventSink) + COM_INTERFACE_ENTRY(IUnknown) END_COM_MAP() BEGIN_SINK_MAP(WebBrowserEventSink) @@ -240,6 +242,8 @@ END_SINK_MAP() ::GetWindowThreadProcessId(hwnd, &process_id_to_wait_for_); OnQuit(); + CoDisconnectObject(this, 0); + DispEventUnadvise(web_browser2_); } #ifdef _DEBUG STDMETHOD(Invoke)(DISPID dispid, REFIID riid, diff --git a/chrome_frame/test/run_all_unittests.cc b/chrome_frame/test/run_all_unittests.cc index 7772259..a943671 100644 --- a/chrome_frame/test/run_all_unittests.cc +++ b/chrome_frame/test/run_all_unittests.cc @@ -60,10 +60,16 @@ base::ProcessHandle LoadCrashService() { return crash_service; } +void PureCall() { + __debugbreak(); +} + int main(int argc, char **argv) { base::EnableTerminationOnHeapCorruption(); PlatformThread::SetName("ChromeFrame tests"); + _set_purecall_handler(PureCall); + TestSuite test_suite(argc, argv); if (CommandLine::ForCurrentProcess()->HasSwitch(kRunAsServer)) { -- cgit v1.1