summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-01-04 16:05:01 +0100
committerMiklos Vajna <vmiklos@collabora.com>2022-01-04 17:04:02 +0100
commit18444c2822e6561aa302f28f8166042b8dad0fe1 (patch)
treecd406f9506c28a8e30c275633becefa7d74ae580
parent746127cf803070c5a695a7cb30a2ecdb5a777e75 (diff)
Revert "use comphelper::WeakComponentImplHelper in AccessibleSlideSorterView"
This reverts commit 2d541dedde4ec516eacd7669bdc3ed8fb6fc2548. It switched to a non-recursive mutex in AccessibleSlideSorterView, which now deadlocks regularly when opening Impress documents: #0 0x00007ffff65b5de3 in __lll_lock_wait () at /lib64/libpthread.so.0 #1 0x00007ffff65ae301 in pthread_mutex_lock () at /lib64/libpthread.so.0 #2 0x00007fffcdac12ed in __gthread_mutex_lock(__gthread_mutex_t*) (__mutex=0x5646c40) at /usr/include/c++/7/x86_64-suse-linux/bits/gthr-default.h:748 #3 0x00007fffcdac2f40 in std::mutex::lock() (this=0x5646c40) at /usr/include/c++/7/bits/std_mutex.h:103 #4 0x00007fffcdac3fcf in std::unique_lock<std::mutex>::lock() (this=0x7fffffffb980) at /usr/include/c++/7/bits/std_mutex.h:267 #5 0x00007fffcdac3c86 in std::unique_lock<std::mutex>::unique_lock(std::mutex&) (this=0x7fffffffb980, __m=...) at /usr/include/c++/7/bits/std_mutex.h:197 #6 0x00007fffcdac514b in accessibility::AccessibleSlideSorterView::getAccessibleChildCount() (this=0x5646c10) at sd/source/ui/accessibility/AccessibleSlideSorterView.cxx:200 #7 0x00007fffdce577c3 in AtkListener::updateChildList(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleContext> const&) (this=0x5647130, pContext=uno::Reference to (class accessibility::AccessibleSlideSorterView *) 0x5646c88) at vcl/unx/gtk3/a11y/atklistener.cxx:149 #8 0x00007fffdce579e0 in AtkListener::handleChildAdded(com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessibleContext> const&, com::sun::star::uno::Reference<com::sun::star::accessibility::XAccessible> const&) (this=0x5647130, rxParent=uno::Reference to (class accessibility::AccessibleSlideSorterView *) 0x5646c88, rxAccessible=uno::Reference to (class accessibility::AccessibleSlideSorterObject *) 0x42d3698) at vcl/unx/gtk3/a11y/atklistener.cxx:178 #9 0x00007fffdce5806e in AtkListener::notifyEvent(com::sun::star::accessibility::AccessibleEventObject const&) (this=0x5647130, aEvent=...) at vcl/unx/gtk3/a11y/atklistener.cxx:441 #10 0x00007ffff4fef0d5 in comphelper::AccessibleEventNotifier::addEvent(unsigned int, com::sun::star::accessibility::AccessibleEventObject const&) (_nClient=44, _rEvent=...) at comphelper/source/misc/accessibleeventnotifier.cxx:262 #11 0x00007fffcdac4df2 in accessibility::AccessibleSlideSorterView::FireAccessibleEvent(short, com::sun::star::uno::Any const&, com::sun::star::uno::Any const&) (this=0x5646c10, nEventId=7, rOldValue=uno::Any(void), rNewValue=uno::Any("com.sun.star.accessibility.XAccessible": {<com::sun::star::uno::XInterface> = {_vptr.XInterface = 0x42d3698}, <No data fields>})) at sd/source/ui/accessibility/AccessibleSlideSorterView.cxx:148 #12 0x00007fffcdac7bf0 in accessibility::AccessibleSlideSorterView::Implementation::GetAccessibleChild(int) (this=0x5646ce0, nIndex=1) at sd/source/ui/accessibility/AccessibleSlideSorterView.cxx:746 #13 0x00007fffcdac79ca in accessibility::AccessibleSlideSorterView::Implementation::GetVisibleChild(int) (this=0x5646ce0, nIndex=1) at sd/source/ui/accessibility/AccessibleSlideSorterView.cxx:725 #14 0x00007fffcdac529d in accessibility::AccessibleSlideSorterView::getAccessibleChild(int) (this=0x5646c10, nIndex=1) at sd/source/ui/accessibility/AccessibleSlideSorterView.cxx:213 The problem is that both getAccessibleChild() and getAccessibleChildCount() take a lock, so this requires a resursive mutex for now. Change-Id: I32205d19451d86e112922e3194661cce2406f70a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/127946 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
-rw-r--r--sd/source/ui/accessibility/AccessibleSlideSorterView.cxx22
-rw-r--r--sd/source/ui/inc/AccessibleSlideSorterView.hxx12
2 files changed, 18 insertions, 16 deletions
diff --git a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
index b4f7d79d6ead..87eea89d2199 100644
--- a/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
+++ b/sd/source/ui/accessibility/AccessibleSlideSorterView.cxx
@@ -47,7 +47,6 @@
#include <rtl/ref.hxx>
#include <sal/log.hxx>
#include <i18nlangtag/languagetag.hxx>
-#include <osl/diagnose.h>
#include <vcl/settings.hxx>
#include <vcl/svapp.hxx>
@@ -115,7 +114,8 @@ private:
AccessibleSlideSorterView::AccessibleSlideSorterView(
::sd::slidesorter::SlideSorter& rSlideSorter,
vcl::Window* pContentWindow)
- : mrSlideSorter(rSlideSorter),
+ : AccessibleSlideSorterViewBase(m_aMutex),
+ mrSlideSorter(rSlideSorter),
mnClientId(0),
mpContentWindow(pContentWindow)
{
@@ -149,7 +149,7 @@ void AccessibleSlideSorterView::FireAccessibleEvent (
}
}
-void AccessibleSlideSorterView::disposing(std::unique_lock<std::mutex>&)
+void SAL_CALL AccessibleSlideSorterView::disposing()
{
if (mnClientId != 0)
{
@@ -163,7 +163,7 @@ AccessibleSlideSorterObject* AccessibleSlideSorterView::GetAccessibleChildImplem
sal_Int32 nIndex)
{
AccessibleSlideSorterObject* pResult = nullptr;
- std::unique_lock aGuard (m_aMutex);
+ ::osl::MutexGuard aGuard (m_aMutex);
if (nIndex>=0 && nIndex<mpImpl->GetVisibleChildCount())
pResult = mpImpl->GetVisibleChild(nIndex);
@@ -173,7 +173,7 @@ AccessibleSlideSorterObject* AccessibleSlideSorterView::GetAccessibleChildImplem
void AccessibleSlideSorterView::Destroyed()
{
- std::unique_lock aGuard (m_aMutex);
+ ::osl::MutexGuard aGuard (m_aMutex);
// Send a disposing to all listeners.
if (mnClientId != 0)
@@ -197,7 +197,7 @@ Reference<XAccessibleContext > SAL_CALL
sal_Int32 SAL_CALL AccessibleSlideSorterView::getAccessibleChildCount()
{
ThrowIfDisposed();
- std::unique_lock aGuard (m_aMutex);
+ ::osl::MutexGuard aGuard (m_aMutex);
return mpImpl->GetVisibleChildCount();
}
@@ -205,7 +205,7 @@ Reference<XAccessible > SAL_CALL
AccessibleSlideSorterView::getAccessibleChild (sal_Int32 nIndex)
{
ThrowIfDisposed();
- std::unique_lock aGuard (m_aMutex);
+ ::osl::MutexGuard aGuard (m_aMutex);
if (nIndex<0 || nIndex>=mpImpl->GetVisibleChildCount())
throw lang::IndexOutOfBoundsException();
@@ -325,9 +325,9 @@ void SAL_CALL AccessibleSlideSorterView::addAccessibleEventListener(
if (!rxListener.is())
return;
- const std::unique_lock aGuard(m_aMutex);
+ const osl::MutexGuard aGuard(m_aMutex);
- if (m_bDisposed)
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
{
uno::Reference<uno::XInterface> x (static_cast<lang::XComponent *>(this), uno::UNO_QUERY);
rxListener->disposing (lang::EventObject (x));
@@ -347,7 +347,7 @@ void SAL_CALL AccessibleSlideSorterView::removeAccessibleEventListener(
if (!rxListener.is())
return;
- const std::unique_lock aGuard(m_aMutex);
+ const osl::MutexGuard aGuard(m_aMutex);
if (mnClientId == 0)
return;
@@ -612,7 +612,7 @@ uno::Sequence< OUString> SAL_CALL
void AccessibleSlideSorterView::ThrowIfDisposed()
{
- if (m_bDisposed)
+ if (rBHelper.bDisposed || rBHelper.bInDispose)
{
SAL_WARN("sd", "Calling disposed object. Throwing exception:");
throw lang::DisposedException ("object has been already disposed",
diff --git a/sd/source/ui/inc/AccessibleSlideSorterView.hxx b/sd/source/ui/inc/AccessibleSlideSorterView.hxx
index b547f7e51432..85003b72d138 100644
--- a/sd/source/ui/inc/AccessibleSlideSorterView.hxx
+++ b/sd/source/ui/inc/AccessibleSlideSorterView.hxx
@@ -19,7 +19,8 @@
#pragma once
-#include <comphelper/compbase.hxx>
+#include <cppuhelper/basemutex.hxx>
+#include <cppuhelper/compbase.hxx>
#include <com/sun/star/accessibility/XAccessible.hpp>
#include <com/sun/star/accessibility/XAccessibleContext.hpp>
#include <com/sun/star/accessibility/XAccessibleComponent.hpp>
@@ -37,7 +38,7 @@ namespace accessibility {
class AccessibleSlideSorterObject;
-typedef comphelper::WeakComponentImplHelper<
+typedef ::cppu::WeakComponentImplHelper<
css::accessibility::XAccessible,
css::accessibility::XAccessibleEventBroadcaster,
css::accessibility::XAccessibleContext,
@@ -50,8 +51,9 @@ typedef comphelper::WeakComponentImplHelper<
of the AccessibleSlideSorterObject class to the make the page objects
accessible.
*/
-class AccessibleSlideSorterView final
- : public AccessibleSlideSorterViewBase
+class AccessibleSlideSorterView
+ : public cppu::BaseMutex,
+ public AccessibleSlideSorterViewBase
{
public:
AccessibleSlideSorterView(
@@ -72,7 +74,7 @@ public:
const css::uno::Any& rOldValue,
const css::uno::Any& rNewValue);
- virtual void disposing(std::unique_lock<std::mutex>&) override;
+ virtual void SAL_CALL disposing() override;
/** Return the implementation object of the specified child.
@param nIndex