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

svx: fix deadlock in accessibility::ChildrenManagerImpl

svx_unoapi svx.AccessibleShape on Windows:
One thread in ChildrenManagerImpl::GetChild() calling eventually
SdXShape::getPropertyValue() blocking on SolarMutex,
other thread calling ChildrenManagerImpl::CreateListOfVisibleShapes().

Not obvious if it's possible to release the maMutex in GetChild() around
calling ShapeTypeHandler::Instance().CreateAccessibleObject(),
since other methods here call GetChild() with maMutex locked themselves;
so just give up and use the SolarMutex in ChildrenManagerImpl too.

Change-Id: I9bf4e5926c4d01308513b1b4e88f20f9fd4c5648
üst e658caed
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "ChildrenManagerImpl.hxx" #include "ChildrenManagerImpl.hxx"
#include <svx/ShapeTypeHandler.hxx> #include <svx/ShapeTypeHandler.hxx>
#include <svx/AccessibleShapeInfo.hxx> #include <svx/AccessibleShapeInfo.hxx>
#include <vcl/svapp.hxx>
#include <com/sun/star/accessibility/AccessibleStateType.hpp> #include <com/sun/star/accessibility/AccessibleStateType.hpp>
#include <com/sun/star/view/XSelectionSupplier.hpp> #include <com/sun/star/view/XSelectionSupplier.hpp>
#include <com/sun/star/container/XChild.hpp> #include <com/sun/star/container/XChild.hpp>
...@@ -139,7 +140,7 @@ uno::Reference<XAccessible> ...@@ -139,7 +140,7 @@ uno::Reference<XAccessible>
{ {
if ( ! rChildDescriptor.mxAccessibleShape.is()) if ( ! rChildDescriptor.mxAccessibleShape.is())
{ {
::osl::MutexGuard aGuard (maMutex); SolarMutexGuard g;
// Make sure that the requested accessible object has not been // Make sure that the requested accessible object has not been
// created while locking the global mutex. // created while locking the global mutex.
if ( ! rChildDescriptor.mxAccessibleShape.is()) if ( ! rChildDescriptor.mxAccessibleShape.is())
...@@ -201,7 +202,7 @@ void ChildrenManagerImpl::Update (bool bCreateNewObjectsOnDemand) ...@@ -201,7 +202,7 @@ void ChildrenManagerImpl::Update (bool bCreateNewObjectsOnDemand)
// 3. Replace the current list of visible shapes with the new one. Do // 3. Replace the current list of visible shapes with the new one. Do
// the same with the visible area. // the same with the visible area.
{ {
::osl::MutexGuard aGuard (maMutex); SolarMutexGuard g;
adjustIndexInParentOfShapes(aChildList); adjustIndexInParentOfShapes(aChildList);
// Use swap to copy the contents of the new list in constant time. // Use swap to copy the contents of the new list in constant time.
...@@ -253,7 +254,7 @@ void ChildrenManagerImpl::Update (bool bCreateNewObjectsOnDemand) ...@@ -253,7 +254,7 @@ void ChildrenManagerImpl::Update (bool bCreateNewObjectsOnDemand)
void ChildrenManagerImpl::CreateListOfVisibleShapes ( void ChildrenManagerImpl::CreateListOfVisibleShapes (
ChildDescriptorListType& raDescriptorList) ChildDescriptorListType& raDescriptorList)
{ {
::osl::MutexGuard aGuard (maMutex); SolarMutexGuard g;
OSL_ASSERT (maShapeTreeInfo.GetViewForwarder() != NULL); OSL_ASSERT (maShapeTreeInfo.GetViewForwarder() != NULL);
...@@ -420,7 +421,7 @@ void ChildrenManagerImpl::AddShape (const Reference<drawing::XShape>& rxShape) ...@@ -420,7 +421,7 @@ void ChildrenManagerImpl::AddShape (const Reference<drawing::XShape>& rxShape)
{ {
if (rxShape.is()) if (rxShape.is())
{ {
::osl::ClearableMutexGuard aGuard (maMutex); SolarMutexClearableGuard aGuard;
// Test visibility of the shape. // Test visibility of the shape.
Rectangle aVisibleArea = maShapeTreeInfo.GetViewForwarder()->GetVisibleArea(); Rectangle aVisibleArea = maShapeTreeInfo.GetViewForwarder()->GetVisibleArea();
...@@ -470,7 +471,7 @@ void ChildrenManagerImpl::RemoveShape (const Reference<drawing::XShape>& rxShape ...@@ -470,7 +471,7 @@ void ChildrenManagerImpl::RemoveShape (const Reference<drawing::XShape>& rxShape
{ {
if (rxShape.is()) if (rxShape.is())
{ {
::osl::ClearableMutexGuard aGuard (maMutex); SolarMutexGuard g;
// Search shape in list of visible children. // Search shape in list of visible children.
ChildDescriptorListType::iterator I ( ChildDescriptorListType::iterator I (
...@@ -571,7 +572,7 @@ void ChildrenManagerImpl::SetInfo (const AccessibleShapeTreeInfo& rShapeTreeInfo ...@@ -571,7 +572,7 @@ void ChildrenManagerImpl::SetInfo (const AccessibleShapeTreeInfo& rShapeTreeInfo
Reference<frame::XController> xCurrentController; Reference<frame::XController> xCurrentController;
Reference<view::XSelectionSupplier> xCurrentSelectionSupplier; Reference<view::XSelectionSupplier> xCurrentSelectionSupplier;
{ {
::osl::MutexGuard aGuard (maMutex); SolarMutexGuard g;
xCurrentBroadcaster = maShapeTreeInfo.GetModelBroadcaster(); xCurrentBroadcaster = maShapeTreeInfo.GetModelBroadcaster();
xCurrentController = maShapeTreeInfo.GetController(); xCurrentController = maShapeTreeInfo.GetController();
xCurrentSelectionSupplier = Reference<view::XSelectionSupplier> ( xCurrentSelectionSupplier = Reference<view::XSelectionSupplier> (
...@@ -751,7 +752,7 @@ void ChildrenManagerImpl::ViewForwarderChanged (ChangeType aChangeType, ...@@ -751,7 +752,7 @@ void ChildrenManagerImpl::ViewForwarderChanged (ChangeType aChangeType,
Update (false); Update (false);
else else
{ {
::osl::MutexGuard aGuard (maMutex); SolarMutexGuard g;
ChildDescriptorListType::iterator I, aEnd = maVisibleChildren.end(); ChildDescriptorListType::iterator I, aEnd = maVisibleChildren.end();
for (I=maVisibleChildren.begin(); I != aEnd; ++I) for (I=maVisibleChildren.begin(); I != aEnd; ++I)
{ {
......
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