From ffc77f555aee05d5abde16be0265fac877cc6ca3 Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Thu, 28 Nov 2013 20:12:12 +0100 Subject: vcl: fix crashes when retrieving objects for MSAA The ImplHandleGetObject() function modifies the Application Settings and must take the SolarMutex for this; otherwise we get crashes when another thread calls StyleSettings::GetPersonaHeader() during some unoapi test. Also fix another HWND to long cast; use LRESULT which is Win32 for intptr_t. Change-Id: I5580f88ed0a8e9955697655ace94584e2307982d (cherry picked from commit db214684057e3ff2fa32d57c00507309dd6c24d6) --- vcl/win/source/window/salframe.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'vcl/win') diff --git a/vcl/win/source/window/salframe.cxx b/vcl/win/source/window/salframe.cxx index 8ee2cae0a3c4..913d53967681 100644 --- a/vcl/win/source/window/salframe.cxx +++ b/vcl/win/source/window/salframe.cxx @@ -5484,7 +5484,8 @@ static void ImplHandleIMENotify( HWND hWnd, WPARAM wParam ) // ----------------------------------------------------------------------- -static bool ImplHandleGetObject( HWND hWnd, LPARAM lParam, WPARAM wParam, long &nRet ) +static bool +ImplHandleGetObject(HWND hWnd, LPARAM lParam, WPARAM wParam, LRESULT & nRet) { // IA2 should be enabled automatically AllSettings aSettings = Application::GetSettings(); @@ -5514,7 +5515,8 @@ static bool ImplHandleGetObject( HWND hWnd, LPARAM lParam, WPARAM wParam, long & // mhOnSetTitleWnd not set to reasonable value anywhere... if ( lParam == OBJID_CLIENT ) { - nRet = xMSAA->getAccObjectPtr( (long)hWnd, lParam, wParam ); + nRet = xMSAA->getAccObjectPtr( + reinterpret_cast(hWnd), lParam, wParam); if( nRet != 0 ) return true; } @@ -6053,12 +6055,12 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP break; case WM_GETOBJECT: - long nRet; + ImplSalYieldMutexAcquireWithWait(); if ( ImplHandleGetObject( hWnd, lParam, wParam, nRet ) ) { rDef = false; - return (HRESULT) nRet; } + ImplSalYieldMutexRelease(); break; case WM_APPCOMMAND: -- cgit v1.2.3