Kaydet (Commit) d28687d5 authored tarafından Michael Stahl's avatar Michael Stahl

winaccessibility: fix locking in UAccCOM

The COM components will (usually? always?) be called on the main thread
via COM, and may also be called on any thread from the UNO event
listeners.  Both ways may access the global AccWinObjectManager.
So the easiest way to lock all that without introducing new deadlocks
seems to be to just use the SolarMutex.

The fact that the main thread is in a COM STA is rather irrelevant here
since we don't currently do the required manual marshalling of the COM
pointers so they can be accessed from UNO event listeners running in
threads other than the main thread anyway.

To get that to build:
- use prewin.h and postwin.h around ATL headers
- link UAccCOM against vcl
- define both UNICODE and _UNICODE to not break on mis-matching TCHAR
  nonsense

Change-Id: I1ccdf7a4a5c2b5f0b9c29ef39d126c4b8a16898a
üst f5a54cbf
......@@ -21,7 +21,8 @@ $(eval $(call gb_Library_set_include,UAccCOM,\
$(eval $(call gb_Library_add_defs,UAccCOM,\
-DUACCCOM_DLLIMPLEMENTATION \
-D_UNICODE=1 \
-D_UNICODE \
-DUNICODE \
))
$(eval $(call gb_Library_use_sdk_api,UAccCOM))
......@@ -54,6 +55,7 @@ $(eval $(call gb_Library_add_ldflags,UAccCOM,\
))
$(eval $(call gb_Library_use_libraries,UAccCOM,\
vcl \
cppu \
sal \
))
......
......@@ -28,6 +28,8 @@
#include <com/sun/star/accessibility/AccessibleRole.hpp>
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
#include <vcl/svapp.hxx>
#include "AccessibleKeyStroke.h"
#ifndef __ACCCOMMON_H_
......@@ -107,6 +109,8 @@ void GetDfActionByUNORole(XAccessibleContext* pRContext, BSTR* pRet)
*/
STDMETHODIMP CAccActionBase::nActions(/*[out,retval]*/long* nActions)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -129,6 +133,8 @@ STDMETHODIMP CAccActionBase::nActions(/*[out,retval]*/long* nActions)
*/
STDMETHODIMP CAccActionBase::doAction(/* [in] */ long actionIndex)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
if( pRXAct.is() )
......@@ -148,6 +154,8 @@ STDMETHODIMP CAccActionBase::doAction(/* [in] */ long actionIndex)
*/
STDMETHODIMP CAccActionBase::get_description(long actionIndex,BSTR __RPC_FAR *description)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -195,6 +203,8 @@ STDMETHODIMP CAccActionBase::get_keyBinding(
/* [length_is][length_is][size_is][size_is][out] */ BSTR __RPC_FAR *__RPC_FAR *keyBinding,
/* [retval][out] */ long __RPC_FAR *nBinding)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
if( !keyBinding || !nBinding)
......@@ -238,7 +248,7 @@ STDMETHODIMP CAccActionBase::get_keyBinding(
*/
STDMETHODIMP CAccActionBase::put_XInterface(hyper pXInterface)
{
// internal IUNOXWrapper - no mutex meeded
ENTER_PROTECTED_BLOCK
......
......@@ -21,6 +21,7 @@
#include "AccComponentBase.h"
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
#include <vcl/svapp.hxx>
#include "MAccessible.h"
using namespace com::sun::star::accessibility;
......@@ -45,6 +46,8 @@ CAccComponentBase::~CAccComponentBase()
*/
STDMETHODIMP CAccComponentBase::get_locationInParent(long *x, long *y)
{
SolarMutexGuard g;
try
{
if (x == NULL || y == NULL)
......@@ -73,6 +76,8 @@ STDMETHODIMP CAccComponentBase::get_locationInParent(long *x, long *y)
*/
STDMETHODIMP CAccComponentBase::get_locationOnScreen(long *x, long *y)
{
SolarMutexGuard g;
try
{
if (x == NULL || y == NULL)
......@@ -100,6 +105,8 @@ STDMETHODIMP CAccComponentBase::get_locationOnScreen(long *x, long *y)
*/
STDMETHODIMP CAccComponentBase::grabFocus(boolean * success)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
if (success == NULL)
......@@ -124,6 +131,8 @@ STDMETHODIMP CAccComponentBase::grabFocus(boolean * success)
*/
STDMETHODIMP CAccComponentBase::get_foreground(IA2Color * foreground)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
if (foreground == NULL)
......@@ -147,6 +156,8 @@ STDMETHODIMP CAccComponentBase::get_foreground(IA2Color * foreground)
*/
STDMETHODIMP CAccComponentBase::get_background(IA2Color * background)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
if (background == NULL)
......@@ -170,6 +181,8 @@ STDMETHODIMP CAccComponentBase::get_background(IA2Color * background)
*/
STDMETHODIMP CAccComponentBase::put_XInterface(hyper pXInterface)
{
// internal IUNOXWrapper - no mutex meeded
ENTER_PROTECTED_BLOCK
CUNOXWrapper::put_XInterface(pXInterface);
......
......@@ -23,6 +23,9 @@
#include "stdafx.h"
#include "UAccCOM.h"
#include "AccEditableText.h"
#include <vcl/svapp.hxx>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
#include <com/sun/star/accessibility/XAccessibleText.hpp>
......@@ -47,6 +50,8 @@ using namespace std;
*/
STDMETHODIMP CAccEditableText::copyText(long startOffset, long endOffset)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK XInterface#
......@@ -72,6 +77,8 @@ STDMETHODIMP CAccEditableText::copyText(long startOffset, long endOffset)
*/
STDMETHODIMP CAccEditableText::deleteText(long startOffset, long endOffset)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
if( !pRXEdtTxt.is() )
......@@ -94,6 +101,8 @@ STDMETHODIMP CAccEditableText::deleteText(long startOffset, long endOffset)
*/
STDMETHODIMP CAccEditableText::insertText(long offset, BSTR * text)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
if (text == NULL)
......@@ -121,6 +130,8 @@ STDMETHODIMP CAccEditableText::insertText(long offset, BSTR * text)
*/
STDMETHODIMP CAccEditableText::cutText(long startOffset, long endOffset)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
if( !pRXEdtTxt.is() )
......@@ -142,6 +153,8 @@ STDMETHODIMP CAccEditableText::cutText(long startOffset, long endOffset)
*/
STDMETHODIMP CAccEditableText::pasteText(long offset)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
if( !pRXEdtTxt.is() )
......@@ -165,6 +178,8 @@ STDMETHODIMP CAccEditableText::pasteText(long offset)
*/
STDMETHODIMP CAccEditableText::replaceText(long startOffset, long endOffset, BSTR * text)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -192,6 +207,8 @@ STDMETHODIMP CAccEditableText::replaceText(long startOffset, long endOffset, BST
*/
STDMETHODIMP CAccEditableText::setAttributes(long startOffset, long endOffset, BSTR * attributes)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -461,7 +478,7 @@ void CAccEditableText::get_AnyFromOLECHAR(const ::rtl::OUString &ouName, const :
*/
STDMETHODIMP CAccEditableText::put_XInterface(hyper pXInterface)
{
// internal IUNOXWrapper - no mutex meeded
ENTER_PROTECTED_BLOCK
......
......@@ -20,6 +20,9 @@
#include "stdafx.h"
#include "UAccCOM.h"
#include "AccHyperLink.h"
#include <vcl/svapp.hxx>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/accessibility/XAccessibleAction.hpp>
#include "MAccessible.h"
......@@ -102,6 +105,8 @@ STDMETHODIMP CAccHyperLink::get_keyBinding(
STDMETHODIMP CAccHyperLink::get_anchor(/* [in] */ long index,
/* [retval][out] */ VARIANT __RPC_FAR *anchor)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -132,6 +137,8 @@ STDMETHODIMP CAccHyperLink::get_anchor(/* [in] */ long index,
STDMETHODIMP CAccHyperLink::get_anchorTarget(/* [in] */ long index,
/* [retval][out] */ VARIANT __RPC_FAR *anchorTarget)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -162,6 +169,8 @@ STDMETHODIMP CAccHyperLink::get_anchorTarget(/* [in] */ long index,
*/
STDMETHODIMP CAccHyperLink::get_startIndex(/* [retval][out] */ long __RPC_FAR *index)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -183,6 +192,8 @@ STDMETHODIMP CAccHyperLink::get_startIndex(/* [retval][out] */ long __RPC_FAR *i
*/
STDMETHODIMP CAccHyperLink::get_endIndex(/* [retval][out] */ long __RPC_FAR *index)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -209,6 +220,8 @@ STDMETHODIMP CAccHyperLink::get_endIndex(/* [retval][out] */ long __RPC_FAR *ind
*/
STDMETHODIMP CAccHyperLink::get_valid(/* [retval][out] */ boolean __RPC_FAR *valid)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -235,6 +248,8 @@ STDMETHODIMP CAccHyperLink::get_valid(/* [retval][out] */ boolean __RPC_FAR *val
*/
STDMETHODIMP CAccHyperLink::put_XInterface(hyper pXInterface)
{
// internal IUNOXWrapper - no mutex meeded
ENTER_PROTECTED_BLOCK
CAccActionBase::put_XInterface(pXInterface);
......@@ -266,6 +281,8 @@ STDMETHODIMP CAccHyperLink::put_XInterface(hyper pXInterface)
*/
STDMETHODIMP CAccHyperLink::put_XSubInterface(hyper pXSubInterface)
{
// internal IUNOXWrapper - no mutex meeded
pRXLink = reinterpret_cast<XAccessibleHyperlink*>(pXSubInterface);
pRXAct = reinterpret_cast<XAccessibleAction*>(pXSubInterface);
......
......@@ -23,6 +23,8 @@
#include "AccHyperLink.h"
#include "acccommon.h"
#include <vcl/svapp.hxx>
using namespace com::sun::star::accessibility;
using namespace com::sun::star::uno;
......@@ -276,6 +278,8 @@ STDMETHODIMP CAccHypertext::scrollSubstringTo(long startIndex, long endIndex,enu
*/
STDMETHODIMP CAccHypertext::get_nHyperlinks(long *hyperlinkCount)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -301,6 +305,8 @@ STDMETHODIMP CAccHypertext::get_nHyperlinks(long *hyperlinkCount)
*/
STDMETHODIMP CAccHypertext::get_hyperlink(long index,IAccessibleHyperlink **hyperlink)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -347,6 +353,8 @@ STDMETHODIMP CAccHypertext::get_hyperlink(long index,IAccessibleHyperlink **hype
*/
STDMETHODIMP CAccHypertext::get_hyperlinkIndex(long charIndex, long *hyperlinkIndex)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -371,7 +379,7 @@ STDMETHODIMP CAccHypertext::get_hyperlinkIndex(long charIndex, long *hyperlinkIn
*/
STDMETHODIMP CAccHypertext::put_XInterface(hyper pXInterface)
{
// internal IUNOXWrapper - no mutex meeded
ENTER_PROTECTED_BLOCK
......
......@@ -20,6 +20,9 @@
#include "stdafx.h"
#include "UAccCOM.h"
#include "AccImage.h"
#include <vcl/svapp.hxx>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
......@@ -33,6 +36,8 @@ using namespace com::sun::star::uno;
*/
STDMETHODIMP CAccImage::get_description(BSTR * description)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -72,7 +77,7 @@ STDMETHODIMP CAccImage::get_imageSize(
*/
STDMETHODIMP CAccImage::put_XInterface(hyper pXInterface)
{
// internal IUNOXWrapper - no mutex meeded
ENTER_PROTECTED_BLOCK
......
......@@ -20,6 +20,9 @@
#include "stdafx.h"
#include "UAccCOM.h"
#include "AccRelation.h"
#include <vcl/svapp.hxx>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
#include "MAccessible.h"
......@@ -34,6 +37,8 @@ using namespace com::sun::star::uno;
*/
STDMETHODIMP CAccRelation::get_relationType(BSTR * relationType)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
if (relationType == NULL)
......@@ -67,6 +72,8 @@ STDMETHODIMP CAccRelation::get_localizedRelationType(BSTR *)
*/
STDMETHODIMP CAccRelation::get_nTargets(long * nTargets)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
if (nTargets == NULL)
......@@ -87,6 +94,8 @@ STDMETHODIMP CAccRelation::get_nTargets(long * nTargets)
*/
STDMETHODIMP CAccRelation::get_target(long targetIndex, IUnknown * * target)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
if (target == NULL)
......@@ -122,6 +131,8 @@ STDMETHODIMP CAccRelation::get_target(long targetIndex, IUnknown * * target)
*/
STDMETHODIMP CAccRelation::get_targets(long, IUnknown * * target, long * nTargets)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -162,6 +173,7 @@ STDMETHODIMP CAccRelation::get_targets(long, IUnknown * * target, long * nTarget
*/
STDMETHODIMP CAccRelation::put_XSubInterface(hyper pXSubInterface)
{
// internal IUNOXWrapper - no mutex meeded
relation = *reinterpret_cast<AccessibleRelation*>(pXSubInterface);
return S_OK;
......
......@@ -23,6 +23,9 @@
#include "stdafx.h"
#include "UAccCOM.h"
#include "AccTable.h"
#include <vcl/svapp.hxx>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include "MAccessible.h"
......@@ -43,6 +46,8 @@ using namespace com::sun::star::uno;
STDMETHODIMP CAccTable::get_accessibleAt(long row, long column, IUnknown * * accessible)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -112,6 +117,8 @@ STDMETHODIMP CAccTable::get_caption(IUnknown * *)
*/
STDMETHODIMP CAccTable::get_columnDescription(long column, BSTR * description)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -143,6 +150,8 @@ STDMETHODIMP CAccTable::get_columnDescription(long column, BSTR * description)
*/
STDMETHODIMP CAccTable::get_columnExtentAt(long row, long column, long * nColumnsSpanned)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
XAccessibleTable *pXAccTable = GetXInterface();
......@@ -174,6 +183,8 @@ STDMETHODIMP CAccTable::get_columnExtentAt(long row, long column, long * nColumn
*/
STDMETHODIMP CAccTable::get_columnHeader(IAccessibleTable __RPC_FAR *__RPC_FAR *accessibleTable, long *startingRowIndex)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -222,6 +233,8 @@ STDMETHODIMP CAccTable::get_columnHeader(IAccessibleTable __RPC_FAR *__RPC_FAR *
*/
STDMETHODIMP CAccTable::get_nColumns(long * columnCount)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -245,6 +258,8 @@ STDMETHODIMP CAccTable::get_nColumns(long * columnCount)
*/
STDMETHODIMP CAccTable::get_nRows(long * rowCount)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -268,6 +283,8 @@ STDMETHODIMP CAccTable::get_nRows(long * rowCount)
*/
STDMETHODIMP CAccTable::get_nSelectedColumns(long * columnCount)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -292,6 +309,8 @@ STDMETHODIMP CAccTable::get_nSelectedColumns(long * columnCount)
*/
STDMETHODIMP CAccTable::get_nSelectedRows(long * rowCount)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -317,6 +336,8 @@ STDMETHODIMP CAccTable::get_nSelectedRows(long * rowCount)
*/
STDMETHODIMP CAccTable::get_rowDescription(long row, BSTR * description)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -349,6 +370,8 @@ STDMETHODIMP CAccTable::get_rowDescription(long row, BSTR * description)
*/
STDMETHODIMP CAccTable::get_rowExtentAt(long row, long column, long * nRowsSpanned)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
XAccessibleTable *pXAccTable = GetXInterface();
......@@ -381,6 +404,8 @@ STDMETHODIMP CAccTable::get_rowExtentAt(long row, long column, long * nRowsSpann
*/
STDMETHODIMP CAccTable::get_rowHeader(IAccessibleTable __RPC_FAR *__RPC_FAR *accessibleTable, long *startingColumnIndex)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -431,6 +456,8 @@ STDMETHODIMP CAccTable::get_rowHeader(IAccessibleTable __RPC_FAR *__RPC_FAR *acc
*/
STDMETHODIMP CAccTable::get_selectedRows(long, long ** rows, long * nRows)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -468,6 +495,8 @@ STDMETHODIMP CAccTable::get_selectedRows(long, long ** rows, long * nRows)
*/
STDMETHODIMP CAccTable::get_selectedColumns(long, long ** columns, long * numColumns)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -503,6 +532,8 @@ STDMETHODIMP CAccTable::get_selectedColumns(long, long ** columns, long * numCol
*/
STDMETHODIMP CAccTable::get_summary(IUnknown * * accessible)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -539,6 +570,8 @@ STDMETHODIMP CAccTable::get_summary(IUnknown * * accessible)
*/
STDMETHODIMP CAccTable::get_isColumnSelected(long column, unsigned char * isSelected)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -563,6 +596,8 @@ STDMETHODIMP CAccTable::get_isColumnSelected(long column, unsigned char * isSele
*/
STDMETHODIMP CAccTable::get_isRowSelected(long row, unsigned char * isSelected)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -589,6 +624,8 @@ STDMETHODIMP CAccTable::get_isRowSelected(long row, unsigned char * isSelected)
*/
STDMETHODIMP CAccTable::get_isSelected(long row, long column, unsigned char * isSelected)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -613,6 +650,8 @@ STDMETHODIMP CAccTable::get_isSelected(long row, long column, unsigned char * is
*/
STDMETHODIMP CAccTable::selectRow(long row)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// Check XAccessibleTable reference.
......@@ -655,6 +694,8 @@ STDMETHODIMP CAccTable::selectRow(long row)
*/
STDMETHODIMP CAccTable::selectColumn(long column)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// Check XAccessibleTable reference.
......@@ -698,6 +739,8 @@ STDMETHODIMP CAccTable::selectColumn(long column)
*/
STDMETHODIMP CAccTable::unselectRow(long row)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// Check XAccessibleTable reference.
......@@ -743,6 +786,8 @@ STDMETHODIMP CAccTable::unselectRow(long row)
*/
STDMETHODIMP CAccTable::unselectColumn(long column)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// Check XAccessibleTable reference.
......@@ -786,6 +831,8 @@ STDMETHODIMP CAccTable::unselectColumn(long column)
*/
STDMETHODIMP CAccTable::put_XInterface(hyper pXInterface)
{
// internal IUNOXWrapper - no mutex meeded
ENTER_PROTECTED_BLOCK
CUNOXWrapper::put_XInterface(pXInterface);
......@@ -814,6 +861,8 @@ STDMETHODIMP CAccTable::put_XInterface(hyper pXInterface)
*/
STDMETHODIMP CAccTable::get_columnIndex(long childIndex, long * columnIndex)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -836,6 +885,8 @@ STDMETHODIMP CAccTable::get_columnIndex(long childIndex, long * columnIndex)
*/
STDMETHODIMP CAccTable::get_rowIndex(long childIndex, long * rowIndex)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -858,6 +909,8 @@ STDMETHODIMP CAccTable::get_rowIndex(long childIndex, long * rowIndex)
*/
STDMETHODIMP CAccTable::get_childIndex(long RowIndex , long columnIndex, long * childIndex )
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -899,6 +952,8 @@ STDMETHODIMP CAccTable::get_modelChange(IA2TableModelChange *)
// Number of children currently selected
STDMETHODIMP CAccTable::get_nSelectedChildren(long *childCount)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -928,6 +983,8 @@ STDMETHODIMP CAccTable::get_nSelectedChildren(long *childCount)
// Length of array (not more than maxChildren)
STDMETHODIMP CAccTable::get_selectedChildren(long, long **children, long *nChildren)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......
......@@ -23,8 +23,11 @@
#include "stdafx.h"
#include <string>
#include <com/sun/star/accessibility/AccessibleTextType.hpp>
#include "AccTextBase.h"
#include <vcl/svapp.hxx>
#include <com/sun/star/accessibility/AccessibleTextType.hpp>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
......@@ -57,6 +60,8 @@ CAccTextBase::~CAccTextBase()
*/
STDMETHODIMP CAccTextBase::get_addSelection(long startOffset, long endOffset)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK XInterface#
......@@ -91,6 +96,8 @@ STDMETHODIMP CAccTextBase::get_addSelection(long startOffset, long endOffset)
*/
STDMETHODIMP CAccTextBase::get_attributes(long offset, long * startOffset, long * endOffset, BSTR * textAttributes)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
if (startOffset == NULL || endOffset == NULL || textAttributes == NULL)
......@@ -211,6 +218,8 @@ STDMETHODIMP CAccTextBase::get_attributes(long offset, long * startOffset, long
*/
STDMETHODIMP CAccTextBase::get_caretOffset(long * offset)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
if (offset == NULL)
......@@ -235,6 +244,8 @@ STDMETHODIMP CAccTextBase::get_caretOffset(long * offset)
*/
STDMETHODIMP CAccTextBase::get_characterCount(long * nCharacters)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
if (nCharacters == NULL)
......@@ -263,6 +274,8 @@ STDMETHODIMP CAccTextBase::get_characterCount(long * nCharacters)
*/
STDMETHODIMP CAccTextBase::get_characterExtents(long offset, IA2CoordinateType coordType, long * x, long * y, long * width, long * height)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
if (x == NULL || height == NULL || y == NULL || width == NULL)
......@@ -333,6 +346,8 @@ STDMETHODIMP CAccTextBase::get_characterExtents(long offset, IA2CoordinateType c
*/
STDMETHODIMP CAccTextBase::get_nSelections(long * nSelections)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
if (nSelections == NULL)
......@@ -377,6 +392,8 @@ STDMETHODIMP CAccTextBase::get_nSelections(long * nSelections)
*/
STDMETHODIMP CAccTextBase::get_offsetAtPoint(long x, long y, IA2CoordinateType, long * offset)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
if (offset == NULL)
......@@ -404,6 +421,8 @@ STDMETHODIMP CAccTextBase::get_offsetAtPoint(long x, long y, IA2CoordinateType,
STDMETHODIMP CAccTextBase::get_selection(long selectionIndex, long * startOffset, long * endOffset)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
if (startOffset == NULL || endOffset == NULL )
......@@ -451,6 +470,8 @@ STDMETHODIMP CAccTextBase::get_selection(long selectionIndex, long * startOffset
*/
STDMETHODIMP CAccTextBase::get_text(long startOffset, long endOffset, BSTR * text)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
if (text == NULL)
......@@ -496,6 +517,8 @@ STDMETHODIMP CAccTextBase::get_text(long startOffset, long endOffset, BSTR * tex
*/
STDMETHODIMP CAccTextBase::get_textBeforeOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK#
......@@ -582,6 +605,8 @@ STDMETHODIMP CAccTextBase::get_textBeforeOffset(long offset, IA2TextBoundaryType
*/
STDMETHODIMP CAccTextBase::get_textAfterOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
if (startOffset == NULL || endOffset == NULL || text == NULL)
......@@ -666,6 +691,8 @@ STDMETHODIMP CAccTextBase::get_textAfterOffset(long offset, IA2TextBoundaryType
*/
STDMETHODIMP CAccTextBase::get_textAtOffset(long offset, IA2TextBoundaryType boundaryType, long * startOffset, long * endOffset, BSTR * text)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
if (startOffset == NULL || text == NULL ||endOffset == NULL)
......@@ -748,6 +775,8 @@ STDMETHODIMP CAccTextBase::get_textAtOffset(long offset, IA2TextBoundaryType bou
*/
STDMETHODIMP CAccTextBase::removeSelection(long selectionIndex)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK XInterface#
......@@ -782,6 +811,8 @@ STDMETHODIMP CAccTextBase::removeSelection(long selectionIndex)
*/
STDMETHODIMP CAccTextBase::setCaretOffset(long offset)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK XInterface#
......@@ -805,6 +836,8 @@ STDMETHODIMP CAccTextBase::setCaretOffset(long offset)
*/
STDMETHODIMP CAccTextBase::setSelection(long, long startOffset, long endOffset)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
// #CHECK XInterface#
......@@ -827,6 +860,8 @@ STDMETHODIMP CAccTextBase::setSelection(long, long startOffset, long endOffset)
*/
STDMETHODIMP CAccTextBase::get_nCharacters(long * nCharacters)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
if (nCharacters == NULL)
......@@ -891,6 +926,8 @@ STDMETHODIMP CAccTextBase::scrollSubstringTo(long, long, IA2ScrollType)
*/
STDMETHODIMP CAccTextBase::put_XInterface(hyper pXInterface)
{
// internal IUNOXWrapper - no mutex meeded
ENTER_PROTECTED_BLOCK
CUNOXWrapper::put_XInterface(pXInterface);
......
......@@ -21,6 +21,9 @@
#include "UAccCOM.h"
#include "AccValue.h"
#include "MAccessible.h"
#include <vcl/svapp.hxx>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
......@@ -35,6 +38,8 @@ using namespace com::sun::star::uno;
STDMETHODIMP CAccValue::get_currentValue(VARIANT * currentValue)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
if (currentValue == NULL)
......@@ -60,6 +65,8 @@ STDMETHODIMP CAccValue::get_currentValue(VARIANT * currentValue)
*/
STDMETHODIMP CAccValue::setCurrentValue(VARIANT value)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
if ( !pRXVal.is() )
......@@ -138,6 +145,8 @@ STDMETHODIMP CAccValue::setCurrentValue(VARIANT value)
*/
STDMETHODIMP CAccValue::get_maximumValue(VARIANT *maximumValue)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
if (maximumValue == NULL)
......@@ -162,6 +171,8 @@ STDMETHODIMP CAccValue::get_maximumValue(VARIANT *maximumValue)
*/
STDMETHODIMP CAccValue::get_minimumValue(VARIANT *mininumValue)
{
SolarMutexGuard g;
ENTER_PROTECTED_BLOCK
if (mininumValue == NULL)
......@@ -186,7 +197,7 @@ STDMETHODIMP CAccValue::get_minimumValue(VARIANT *mininumValue)
*/
STDMETHODIMP CAccValue::put_XInterface(hyper pXInterface)
{
// internal IUNOXWrapper - no mutex meeded
ENTER_PROTECTED_BLOCK
......
......@@ -22,6 +22,7 @@
#include "EnumVariant.h"
#include "MAccessible.h"
#include <vcl/svapp.hxx>
using namespace com::sun::star::uno;
using namespace com::sun::star::accessibility;
......@@ -40,6 +41,8 @@ using namespace com::sun::star::accessibility;
*/
HRESULT STDMETHODCALLTYPE CEnumVariant::Next(ULONG cElements,VARIANT __RPC_FAR *pvar,ULONG __RPC_FAR *pcElementFetched)
{
SolarMutexGuard g;
long l1;
ULONG l2;
......@@ -90,6 +93,8 @@ HRESULT STDMETHODCALLTYPE CEnumVariant::Next(ULONG cElements,VARIANT __RPC_FAR *
*/
HRESULT STDMETHODCALLTYPE CEnumVariant::Skip(ULONG cElements)
{
SolarMutexGuard g;
m_lCurrent += cElements;
if (m_lCurrent > (long)(m_lLBound+m_pXAccessibleSelection->getSelectedAccessibleChildCount()))
{
......@@ -108,6 +113,8 @@ HRESULT STDMETHODCALLTYPE CEnumVariant::Skip(ULONG cElements)
*/
HRESULT STDMETHODCALLTYPE CEnumVariant::Reset( void)
{
SolarMutexGuard g;
m_lCurrent = m_lLBound;
return NOERROR;
}
......@@ -123,6 +130,8 @@ HRESULT STDMETHODCALLTYPE CEnumVariant::Reset( void)
*/
HRESULT STDMETHODCALLTYPE CEnumVariant::Clone(IEnumVARIANT __RPC_FAR *__RPC_FAR *ppenum)
{
SolarMutexGuard g;
CEnumVariant * penum = NULL;
HRESULT hr;
if (ppenum == NULL)
......@@ -151,6 +160,8 @@ HRESULT STDMETHODCALLTYPE CEnumVariant::Clone(IEnumVARIANT __RPC_FAR *__RPC_FAR
*/
HRESULT STDMETHODCALLTYPE CEnumVariant::Create(CEnumVariant __RPC_FAR *__RPC_FAR *ppenum)
{
SolarMutexGuard g;
HRESULT hr = createInstance<CEnumVariant>(IID_IEnumVariant, ppenum);
if (S_OK != hr)
{
......@@ -179,6 +190,8 @@ long CEnumVariant::GetCountOfElements()
*/
STDMETHODIMP CEnumVariant::ClearEnumeration()
{
// internal IEnumVariant - no mutex meeded
pUNOInterface = NULL;
m_pXAccessibleSelection = NULL;
m_lCurrent = m_lLBound;
......@@ -216,6 +229,8 @@ static Reference<XAccessibleSelection> GetXAccessibleSelection(XAccessible* pXAc
*/
STDMETHODIMP CEnumVariant::PutSelection(hyper pXSelection)
{
// internal IEnumVariant - no mutex meeded
pUNOInterface = reinterpret_cast<XAccessible*>(pXSelection);
m_pXAccessibleSelection = GetXAccessibleSelection(pUNOInterface);
return S_OK;
......
......@@ -20,7 +20,6 @@
#ifndef INCLUDED_WINACCESSIBILITY_SOURCE_UACCCOM_MACCESSIBLE_H
#define INCLUDED_WINACCESSIBILITY_SOURCE_UACCCOM_MACCESSIBLE_H
#include <windows.h>
#include "resource.h" // main symbols
#include <map>
#include <com/sun/star/accessibility/XAccessible.hpp>
......
......@@ -30,11 +30,17 @@
//#define _ATL_APARTMENT_THREADED
#include <prewin.h>
#include <windows.h>
#include <atlbase.h>
// You may derive a class from CComModule and use it if you want to override
// something, but do not change the name of _Module
extern CComModule _Module;
#include <atlcom.h>
#include <postwin.h>
#undef OPAQUE
#define ENTER_PROTECTED_BLOCK \
try \
......@@ -49,9 +55,6 @@ extern CComModule _Module;
#define SAFE_SYSFREESTRING(x) { ::SysFreeString(x); x=NULL; }
#include <windows.h>
#undef OPAQUE
//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment