From 73b7358882d406668f79a5e304430f7a7597a327 Mon Sep 17 00:00:00 2001 From: Martin Fuchs Date: Sat, 7 Feb 2004 19:04:03 +0000 Subject: [PATCH] corrected error handling if no web control could be found svn path=/trunk/; revision=8083 --- .../subsys/system/explorer/doxy-footer.html | 2 +- .../subsys/system/explorer/shell/webchild.cpp | 22 ++++++++++--------- .../subsys/system/explorer/shell/webchild.h | 11 ++++++---- .../system/explorer/utility/shellclasses.h | 1 - 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/reactos/subsys/system/explorer/doxy-footer.html b/reactos/subsys/system/explorer/doxy-footer.html index c0e4d311677..bb5836df2b8 100644 --- a/reactos/subsys/system/explorer/doxy-footer.html +++ b/reactos/subsys/system/explorer/doxy-footer.html @@ -3,7 +3,7 @@
ROS Explorer Source Code Documentation -
generated on 05.02.2004 by +
generated on 07.02.2004 by
doxygen
diff --git a/reactos/subsys/system/explorer/shell/webchild.cpp b/reactos/subsys/system/explorer/shell/webchild.cpp index 4abe70db7ec..03ef088b138 100644 --- a/reactos/subsys/system/explorer/shell/webchild.cpp +++ b/reactos/subsys/system/explorer/shell/webchild.cpp @@ -186,7 +186,9 @@ static const CLSID CLSID_MozillaBrowser = WebChildWindow::WebChildWindow(HWND hwnd, const WebChildWndInfo& info) - : super(hwnd) + : super(hwnd), + _evt_handler1(NULL), + _evt_handler2(NULL) { // first try to create MS IE web control HRESULT hr = create_control(hwnd, CLSID_WebBrowser, IID_IWebBrowser2); @@ -197,24 +199,24 @@ WebChildWindow::WebChildWindow(HWND hwnd, const WebChildWndInfo& info) if (SUCCEEDED(hr)) { // handling events using DWebBrowserEvents - _evt_demo1 = new DWebBrowserEventsHandler(_hwnd, _control); + _evt_handler1 = new DWebBrowserEventsHandler(_hwnd, _control); // handling events using DWebBrowserEvents2 - _evt_demo2 = new DWebBrowserEvents2Handler(_hwnd, _control); - } + _evt_handler2 = new DWebBrowserEvents2Handler(_hwnd, _control); - SIfacePtr browser(get_browser()); + SIfacePtr browser(get_browser()); #ifdef __MINGW32__ // MinGW is lacking vtMissing (as of 07.02.2004) - Variant vtMissing; + Variant vtMissing; #endif - browser->Navigate(BStr(info._path), &vtMissing, &vtMissing, &vtMissing, &vtMissing); - //browser->Navigate2(&Variant(info._path), &vtMissing, &vtMissing, &vtMissing, &vtMissing); + browser->Navigate(BStr(info._path), &vtMissing, &vtMissing, &vtMissing, &vtMissing); + //browser->Navigate2(&Variant(info._path), &vtMissing, &vtMissing, &vtMissing, &vtMissing); + } } WebChildWindow::~WebChildWindow() { - delete _evt_demo2; - delete _evt_demo1; + delete _evt_handler2; + delete _evt_handler1; } diff --git a/reactos/subsys/system/explorer/shell/webchild.h b/reactos/subsys/system/explorer/shell/webchild.h index e33ff7fff5e..c5b51d6e300 100644 --- a/reactos/subsys/system/explorer/shell/webchild.h +++ b/reactos/subsys/system/explorer/shell/webchild.h @@ -427,8 +427,11 @@ protected: } } else if (message == WM_CLOSE) { _in_place_object = NULL; - _client_side.detach(SIfacePtr(_control, IID_IOleObject), OLECLOSE_NOSAVE); - _control = NULL; + + if (_control) { + _client_side.detach(SIfacePtr(_control, IID_IOleObject), OLECLOSE_NOSAVE); + _control = NULL; + } } return super::WndProc(message, wparam, lparam); @@ -1356,6 +1359,6 @@ struct WebChildWindow : public IPCtrlWindow } protected: - DWebBrowserEventsHandler* _evt_demo1; - DWebBrowserEvents2Handler* _evt_demo2; + DWebBrowserEventsHandler* _evt_handler1; + DWebBrowserEvents2Handler* _evt_handler2; }; diff --git a/reactos/subsys/system/explorer/utility/shellclasses.h b/reactos/subsys/system/explorer/utility/shellclasses.h index 535814be5c8..5777c28dd22 100644 --- a/reactos/subsys/system/explorer/utility/shellclasses.h +++ b/reactos/subsys/system/explorer/utility/shellclasses.h @@ -332,7 +332,6 @@ template struct SIfacePtr SIfacePtr(IUnknown* unknown, REFIID riid) { CHECKERROR(unknown->QueryInterface(riid, (LPVOID*)&_p)); - //@@ _p->AddRef(); } ~SIfacePtr()