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
This commit is contained in:
Michael Stahl
2013-11-28 20:12:12 +01:00
parent fefacbd92f
commit db21468405

View File

@@ -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 // IA2 should be enabled automatically
AllSettings aSettings = Application::GetSettings(); 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... // mhOnSetTitleWnd not set to reasonable value anywhere...
if ( lParam == OBJID_CLIENT ) if ( lParam == OBJID_CLIENT )
{ {
nRet = xMSAA->getAccObjectPtr( (long)hWnd, lParam, wParam ); nRet = xMSAA->getAccObjectPtr(
reinterpret_cast<sal_Int64>(hWnd), lParam, wParam);
if( nRet != 0 ) if( nRet != 0 )
return true; return true;
} }
@@ -6053,12 +6055,12 @@ LRESULT CALLBACK SalFrameWndProc( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lP
break; break;
case WM_GETOBJECT: case WM_GETOBJECT:
long nRet; ImplSalYieldMutexAcquireWithWait();
if ( ImplHandleGetObject( hWnd, lParam, wParam, nRet ) ) if ( ImplHandleGetObject( hWnd, lParam, wParam, nRet ) )
{ {
rDef = false; rDef = false;
return (HRESULT) nRet;
} }
ImplSalYieldMutexRelease();
break; break;
case WM_APPCOMMAND: case WM_APPCOMMAND: