From 5a8256f3d365acc839f7fdd36d6b93a6fead53f8 Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Thu, 1 Mar 2007 22:34:25 +0000 Subject: Only call OleUninitialize if OleInitialize succeeded. --- win32/ScintillaWin.cxx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index d620f76ff..ae30b9a4d 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -156,6 +156,7 @@ class ScintillaWin : CLIPFORMAT cfColumnSelect; + HRESULT hrOle; DropSource ds; DataObject dob; DropTarget dt; @@ -293,6 +294,8 @@ ScintillaWin::ScintillaWin(HWND hwnd) { cfColumnSelect = static_cast( ::RegisterClipboardFormat(TEXT("MSDEVColumnSelect"))); + hrOle = E_FAIL; + wMain = hwnd; dob.sci = this; @@ -312,7 +315,7 @@ void ScintillaWin::Initialise() { // Initialize COM. If the app has already done this it will have // no effect. If the app hasnt, we really shouldnt ask them to call // it just so this internal feature works. - ::OleInitialize(NULL); + hrOle = ::OleInitialize(NULL); } void ScintillaWin::Finalise() { @@ -321,7 +324,9 @@ void ScintillaWin::Finalise() { SetIdle(false); DestroySystemCaret(); ::RevokeDragDrop(MainHWND()); - ::OleUninitialize(); + if (SUCCEEDED(hrOle)) { + ::OleUninitialize(); + } } HWND ScintillaWin::MainHWND() { -- cgit v1.2.3