summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-01-15 20:02:01 +0000
committerAndras Timar <andras.timar@collabora.com>2024-02-09 20:09:41 +0100
commit460b950968bf6a3f6e7c79997eadb3344be13ac1 (patch)
tree5aedf0f8968ae3ba8e2678b41318481c49cb75df /include
parent627fece9522c8463c268582363cf147027009ff9 (diff)
crashtesting: still seeing occasional impl_notifyEvent_nothrow failures
e.g.: #0 0x00007f5a3a5d45fc in comphelper::OInterfaceContainerHelper3<com::sun::star::document::XDocumentEventListener>::NotifySingleListener<com::sun::star::document::DocumentEvent>::operator()(com::sun::star::uno::Reference<com::sun::star::document::XDocumentEventListener> const&) const (this=this@entry=0x7f5a38ffd680, listener=empty uno::Reference) at include/comphelper/interfacecontainer3.hxx:253 #1 0x00007f5a3a5d9427 in comphelper::OInterfaceContainerHelper3<com::sun::star::document::XDocumentEventListener>::forEach<comphelper::OInterfaceContainerHelper3<com::sun::star::document::XDocumentEventListener>::NotifySingleListener<com::sun::star::document::DocumentEvent> >(comphelper::OInterfaceContainerHelper3<com::sun::star::document::XDocumentEventListener>::NotifySingleListener<com::sun::star::document::DocumentEvent> const&) (this=this@entry=0x7f5a3035ea08, func=...) at include/comphelper/interfacecontainer3.hxx:275 xListener = empty uno::Reference iter = {rCont = @0x7f5a3035ea08, maData = {m_pimpl = 0x7f5a30132260}, nRemain = 1} #2 0x00007f5a3a5d950e in comphelper::OInterfaceContainerHelper3<com::sun::star::document::XDocumentEventListener>::notifyEach<com::sun::star::document::DocumentEvent>(void (com::sun::star::document::XDocumentEventListener::*)(com::sun::star::document::DocumentEvent const&), com::sun::star::document::DocumentEvent const&) (this=this@entry=0x7f5a3035ea08, NotificationMethod=<optimized out>, Event=...) at include/comphelper/interfacecontainer3.hxx:290 #3 0x00007f5a3a5d39f9 in dbaccess::DocumentEventNotifier_Impl::impl_notifyEvent_nothrow(com::sun::star::document::DocumentEvent const&) (this=this@entry=0x7f5a3035e9c0, _rEvent=...) at dbaccess/source/core/dataaccess/documenteventnotifier.cxx:200 __func__ = "impl_notifyEvent_nothrow" #4 0x00007f5a3a5d3b83 in dbaccess::DocumentEventNotifier_Impl::processEvent(comphelper::AnyEvent const&) (this=this@entry=0x7f5a3035e9c0, _rEvent=...) at dbaccess/source/core/dataaccess/documenteventnotifier.cxx:233 rEventHolder = <optimized out> #5 0x00007f5a57cd95ba in comphelper::AsyncEventNotifierBase::execute() (this=this@entry=0x7f5a3010f670) at comphelper/source/misc/asyncnotification.cxx:139 so lets guard the OInterfaceIteratorHelper3 ctor. might as well use empty() to return early then, and align the OInterfaceIteratorHelper4 case with that. Change-Id: I138841840e032e6524792fb75168ccabc666b34c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/162127 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com> (cherry picked from commit dd8dad09097225726cbcd878d95d5bd0aacdf042) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/163101 Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Diffstat (limited to 'include')
-rw-r--r--include/comphelper/interfacecontainer3.hxx4
-rw-r--r--include/comphelper/interfacecontainer4.hxx2
2 files changed, 5 insertions, 1 deletions
diff --git a/include/comphelper/interfacecontainer3.hxx b/include/comphelper/interfacecontainer3.hxx
index 05a82212c064..be140d32289f 100644
--- a/include/comphelper/interfacecontainer3.hxx
+++ b/include/comphelper/interfacecontainer3.hxx
@@ -266,7 +266,11 @@ template <class T>
template <typename FuncT>
inline void OInterfaceContainerHelper3<T>::forEach(FuncT const& func)
{
+ osl::ClearableMutexGuard aGuard(mrMutex);
+ if (std::as_const(maData)->empty())
+ return;
OInterfaceIteratorHelper3<T> iter(*this);
+ aGuard.clear();
while (iter.hasMoreElements())
{
auto xListener = iter.next();
diff --git a/include/comphelper/interfacecontainer4.hxx b/include/comphelper/interfacecontainer4.hxx
index a8b2bdc85505..e4a41e30675d 100644
--- a/include/comphelper/interfacecontainer4.hxx
+++ b/include/comphelper/interfacecontainer4.hxx
@@ -288,7 +288,7 @@ inline void OInterfaceContainerHelper4<T>::forEach(std::unique_lock<std::mutex>&
FuncT const& func) const
{
assert(rGuard.owns_lock());
- if (std::as_const(maData)->size() == 0)
+ if (std::as_const(maData)->empty())
{
return;
}