summaryrefslogtreecommitdiff
path: root/plugins/IEView/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/IEView/src')
-rw-r--r--plugins/IEView/src/IEView.cpp41
-rw-r--r--plugins/IEView/src/IEView.h4
-rw-r--r--plugins/IEView/src/ieview_main.cpp1
-rw-r--r--plugins/IEView/src/ieview_services.cpp3
4 files changed, 12 insertions, 37 deletions
diff --git a/plugins/IEView/src/IEView.cpp b/plugins/IEView/src/IEView.cpp
index 5b5594b575..a9d75c3a85 100644
--- a/plugins/IEView/src/IEView.cpp
+++ b/plugins/IEView/src/IEView.cpp
@@ -27,11 +27,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#define DISPID_NAVIGATECOMPLETE2 252 // UIActivate new document
#define DISPID_DOCUMENTCOMPLETE 259 // new document goes ReadyState_Complete
-IEView * IEView::list = NULL;
-CRITICAL_SECTION IEView::mutex;
-bool IEView::isInited = false;
-
-
+IEView* IEView::list = NULL;
+mir_cs IEView::mutex;
static LRESULT CALLBACK IEViewServerWindowProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
@@ -290,12 +287,10 @@ IEView::IEView(HWND parent, HTMLBuilder* builder, int x, int y, int cx, int cy)
setBorder();
IConnectionPointContainer* pCPContainer;
// Step 1: Get a pointer to the connection point container.
- if (SUCCEEDED(pWebBrowser->QueryInterface(IID_IConnectionPointContainer,
- (void**)&pCPContainer))) {
+ if (SUCCEEDED(pWebBrowser->QueryInterface(IID_IConnectionPointContainer, (void**)&pCPContainer))) {
// m_pConnectionPoint is defined like this:
// Step 2: Find the connection point.
- if (SUCCEEDED(pCPContainer->FindConnectionPoint(DIID_DWebBrowserEvents2,
- &m_pConnectionPoint))) {
+ if (SUCCEEDED(pCPContainer->FindConnectionPoint(DIID_DWebBrowserEvents2, &m_pConnectionPoint))) {
// Step 3: Advise the connection point that you
// want to sink its events.
sink = new IEViewSink(this);
@@ -358,25 +353,12 @@ IEView::~IEView()
DestroyWindow(hwnd);
}
-void IEView::init()
-{
- if (isInited) return;
-
- isInited = true;
- InitializeCriticalSection(&mutex);
-}
-
void IEView::release()
{
- if (!isInited)
- return;
-
- EnterCriticalSection(&mutex);
+ mir_cslock lck(mutex);
while (list != NULL)
delete list;
-
- LeaveCriticalSection(&mutex);
- DeleteCriticalSection(&mutex);
+ list = NULL;
}
IEView* IEView::get(HWND hwnd)
@@ -635,12 +617,11 @@ STDMETHODIMP IEView::ShowContextMenu(DWORD dwID, POINT *ppt, IUnknown *pcmdTarge
hwnd,
(RECT*)NULL);
DestroyMenu(hMenu);
- if (iSelection == ID_MENU_CLEARLOG) {
+ if (iSelection == ID_MENU_CLEARLOG)
clear(NULL);
- }
- else {
+ else
SendMessage(hSPWnd, WM_COMMAND, iSelection, (LPARAM)NULL);
- }
+
pOleWindow->Release();
}
pOleCommandTarget->Release();
@@ -882,10 +863,10 @@ void IEView::write(const wchar_t *text)
VARIANT *variant;
::SafeArrayAccessData(safe_array, (LPVOID *)&variant);
variant->vt = VT_BSTR;
- BSTR bstr = variant->bstrVal = ::SysAllocString(text);
+ variant->bstrVal = ::SysAllocString(text);
::SafeArrayUnaccessData(safe_array);
document->write(safe_array);
- ::SysFreeString(bstr);
+ // ::SysFreeString(bstr); // don't free it !!!!!!!
::SafeArrayDestroy(safe_array);
}
document->Release();
diff --git a/plugins/IEView/src/IEView.h b/plugins/IEView/src/IEView.h
index 6f4aa7eb60..6621500830 100644
--- a/plugins/IEView/src/IEView.h
+++ b/plugins/IEView/src/IEView.h
@@ -423,8 +423,7 @@ public:
class IEView :public IDispatch, public IOleClientSite, public IOleInPlaceSite, public IDocHostUIHandler, public IInternetSecurityManager, public IServiceProvider {
private:
static IEView *list;
- static CRITICAL_SECTION mutex;
- static bool isInited;
+ static mir_cs mutex;
HWND parent;
HWND hwnd;
IEView *prev, *next;
@@ -555,7 +554,6 @@ public:
void setContact(MCONTACT hContact);
static IEView* get(HWND);
- static void init();
static void release();
static void setOptions();
diff --git a/plugins/IEView/src/ieview_main.cpp b/plugins/IEView/src/ieview_main.cpp
index 0c60062db8..cc61f03939 100644
--- a/plugins/IEView/src/ieview_main.cpp
+++ b/plugins/IEView/src/ieview_main.cpp
@@ -53,7 +53,6 @@ extern "C" __declspec(dllexport) PLUGININFOEX *MirandaPluginInfoEx(DWORD)
static int ModulesLoaded(WPARAM, LPARAM)
{
- IEView::init();
Options::init();
return 0;
}
diff --git a/plugins/IEView/src/ieview_services.cpp b/plugins/IEView/src/ieview_services.cpp
index 6357f73764..8a79a035f3 100644
--- a/plugins/IEView/src/ieview_services.cpp
+++ b/plugins/IEView/src/ieview_services.cpp
@@ -24,7 +24,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
INT_PTR HandleIEWindow(WPARAM, LPARAM lParam)
{
IEVIEWWINDOW *window = (IEVIEWWINDOW *)lParam;
- IEView::init();
Options::init();
if (window->iType == IEW_CREATE) {
HTMLBuilder *builder = NULL;
@@ -75,7 +74,6 @@ INT_PTR HandleIEWindow(WPARAM, LPARAM lParam)
INT_PTR HandleIEEvent(WPARAM, LPARAM lParam)
{
IEVIEWEVENT *event = (IEVIEWEVENT *)lParam;
- IEView::init();
Options::init();
IEView *view = IEView::get(event->hwnd);
if (view != NULL) {
@@ -96,7 +94,6 @@ INT_PTR HandleIEEvent(WPARAM, LPARAM lParam)
INT_PTR HandleIENavigate(WPARAM, LPARAM lParam)
{
IEVIEWNAVIGATE *navigate = (IEVIEWNAVIGATE *)lParam;
- IEView::init();
Options::init();
IEView *view = IEView::get(navigate->hwnd);
if (view != NULL) {