From 621143588b3cb438baf27fb6893ab02e7b06f9dd Mon Sep 17 00:00:00 2001 From: Michael Stahl Date: Tue, 21 Mar 2023 19:10:14 +0100 Subject: Revert "avmedia : use std::mutex instead of osl::Mutex" This reverts commit 477fa6c3cb92f578032dee60482718efdb8f44f2. MissingPluginInstaller requires a recursive lock: Thread 2 (Thread 0x7f8e73d69700 (LWP 29931)): 0 __lll_lock_wait () at /lib64/libpthread.so.0 ... 5 std::unique_lock::lock() (this=0x7f8e73d65a88) at /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/bits/std_mutex.h:267 6 std::unique_lock::unique_lock(std::mutex&) (this=0x7f8e73d65a88, __m=...) at /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/bits/std_mutex.h:197 7 avmedia::gstreamer::(anonymous namespace)::MissingPluginInstaller::detach(avmedia::gstreamer::Player const*) (this=0x7f8e644c6be0 ::get()::instance>, source=0x75d2fa0) at avmedia/source/gstreamer/gstplayer.cxx:187 8 avmedia::gstreamer::Player::disposing() (this=0x75d2fa0) at avmedia/source/gstreamer/gstplayer.cxx:334 9 cppu::WeakComponentImplHelperBase::dispose() (this=0x75d2fa0) at cppuhelper/source/implbase.cxx:104 10 cppu::PartialWeakComponentImplHelper::dispose() (this=0x75d2fa0) at include/cppuhelper/compbase.hxx:90 11 cppu::WeakComponentImplHelperBase::release() (this=0x75d2fa0) at cppuhelper/source/implbase.cxx:79 13 rtl::Reference::~Reference() (this=0x7f8e7c028f20) at include/rtl/ref.hxx:129 ... 21 std::__debug::set, std::less >, std::allocator > >::clear() (this=0x7f8e644c6cd8 ::get()::instance+248>) at /opt/rh/devtoolset-7/root/usr/lib/gcc/x86_64-redhat-linux/7/../../../../include/c++/7/debug/set.h:426 22 avmedia::gstreamer::(anonymous namespace)::MissingPluginInstaller::report(rtl::Reference const&, _GstMessage*) (this=0x7f8e644c6be0 ::get()::instance>, source=..., message=0x7cdb400) at avmedia/source/gstreamer/gstplayer.cxx:156 23 avmedia::gstreamer::Player::processSyncMessage(_GstMessage*) (this=0x75abfe0, message=0x7cdb400) at avmedia/source/gstreamer/gstplayer.cxx:536 24 avmedia::gstreamer::pipeline_bus_sync_handler(_GstBus*, _GstMessage*, void*) (message=0x7cdb400, data=0x75abfe0) at avmedia/source/gstreamer/gstplayer.cxx:382 25 gst_bus_post () at /lib64/libgstreamer-1.0.so.0 Change-Id: Ia8e7fef4d4cee2dde7189702af6dddf883b6cceb Reviewed-on: https://gerrit.libreoffice.org/c/core/+/149233 Tested-by: Jenkins Reviewed-by: Michael Stahl --- avmedia/source/gstreamer/gstplayer.cxx | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) (limited to 'avmedia') diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx index 7d7602b5b3eb..b841c576be17 100644 --- a/avmedia/source/gstreamer/gstplayer.cxx +++ b/avmedia/source/gstreamer/gstplayer.cxx @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -99,7 +98,7 @@ private: DECL_STATIC_LINK(MissingPluginInstaller, launchUi, void*, void); - std::mutex mutex_; + osl::Mutex mutex_; std::set reported_; std::map>> queued_; rtl::Reference currentThread_; @@ -111,7 +110,7 @@ private: MissingPluginInstaller::~MissingPluginInstaller() { - std::unique_lock g(mutex_); + osl::MutexGuard g(mutex_); SAL_WARN_IF(currentThread_.is(), "avmedia.gstreamer", "unjoined thread"); inCleanUp_ = true; } @@ -139,7 +138,7 @@ void MissingPluginInstaller::report( rtl::Reference join; rtl::Reference launch; { - std::unique_lock g(mutex_); + osl::MutexGuard g(mutex_); if (reported_.find(detStr) != reported_.end()) { return; } @@ -184,7 +183,7 @@ void eraseSource(std::set> & set, Player const * source) void MissingPluginInstaller::detach(Player const * source) { rtl::Reference join; { - std::unique_lock g(mutex_); + osl::MutexGuard g(mutex_); if (inCleanUp_) { // Guard against ~MissingPluginInstaller with erroneously un-joined // currentThread_ (thus non-empty currentSources_) calling @@ -256,7 +255,7 @@ void MissingPluginInstallerThread::execute() { for (;;) { std::vector details; { - std::unique_lock g(inst.mutex_); + osl::MutexGuard g(inst.mutex_); assert(!inst.currentDetails_.empty()); details.swap(inst.currentDetails_); } @@ -269,7 +268,7 @@ void MissingPluginInstallerThread::execute() { args.push_back(nullptr); gst_install_plugins_sync(args.data(), nullptr); { - std::unique_lock g(inst.mutex_); + osl::MutexGuard g(inst.mutex_); if (inst.queued_.empty() || inst.launchNewThread_) { inst.launchNewThread_ = true; break; -- cgit