[Libreoffice-commits] core.git: slideshow/source

Stephan Bergmann (via logerrit) logerrit at kemper.freedesktop.org
Wed Aug 28 07:36:21 UTC 2019


 slideshow/source/engine/eventmultiplexer.cxx |   37 +++++++++++++++------------
 1 file changed, 21 insertions(+), 16 deletions(-)

New commits:
commit 042e30a3dc057aef4a02d95960e4dd4fb8d083ae
Author:     Stephan Bergmann <sbergman at redhat.com>
AuthorDate: Wed Aug 28 08:43:44 2019 +0200
Commit:     Stephan Bergmann <sbergman at redhat.com>
CommitDate: Wed Aug 28 09:34:38 2019 +0200

    Avoid adding a function template declaration to namespace std
    
    Change-Id: I1368276c859d3c81f4ebfbeca47bb99e781f2fed
    Reviewed-on: https://gerrit.libreoffice.org/78214
    Tested-by: Jenkins
    Reviewed-by: Stephan Bergmann <sbergman at redhat.com>

diff --git a/slideshow/source/engine/eventmultiplexer.cxx b/slideshow/source/engine/eventmultiplexer.cxx
index 07f7ddaa8af7..1ea583da8d9c 100644
--- a/slideshow/source/engine/eventmultiplexer.cxx
+++ b/slideshow/source/engine/eventmultiplexer.cxx
@@ -45,19 +45,23 @@
 #include <functional>
 #include <memory>
 #include <algorithm>
+#include <utility>
 #include <vector>
 
 using namespace ::com::sun::star;
 
-
-namespace std
+namespace
 {
     // add operator== for weak_ptr, so we can use std::find over lists of them
-    template<typename T> static bool operator==( weak_ptr<T> const& rLHS,
-                                          weak_ptr<T> const& rRHS )
-    {
-        return rLHS.lock().get() == rRHS.lock().get();
-    }
+    struct ViewEventHandlerWeakPtrWrapper final {
+        slideshow::internal::ViewEventHandlerWeakPtr ptr;
+
+        ViewEventHandlerWeakPtrWrapper(slideshow::internal::ViewEventHandlerWeakPtr thePtr):
+            ptr(std::move(thePtr)) {}
+
+        bool operator ==(ViewEventHandlerWeakPtrWrapper const & other) const
+        { return ptr.lock().get() == other.ptr.lock().get(); }
+    };
 }
 
 namespace slideshow {
@@ -209,8 +213,8 @@ struct EventMultiplexerImpl
         PauseEventHandlerSharedPtr,
         std::vector<PauseEventHandlerSharedPtr> >         ImplPauseHandlers;
     typedef ThreadUnsafeListenerContainer<
-        ViewEventHandlerWeakPtr,
-        std::vector<ViewEventHandlerWeakPtr> >            ImplViewHandlers;
+        ViewEventHandlerWeakPtrWrapper,
+        std::vector<ViewEventHandlerWeakPtrWrapper> >     ImplViewHandlers;
     typedef ThreadUnsafeListenerContainer<
         ViewRepaintHandlerSharedPtr,
         std::vector<ViewRepaintHandlerSharedPtr> >        ImplRepaintHandlers;
@@ -1101,8 +1105,8 @@ void EventMultiplexer::notifyViewAdded( const UnoViewSharedPtr& rView )
             mpImpl->mxListener.get() );
 
     mpImpl->maViewHandlers.applyAll(
-        [&rView]( const ViewEventHandlerWeakPtr& pHandler )
-        { return pHandler.lock()->viewAdded( rView ); } );
+        [&rView]( const ViewEventHandlerWeakPtrWrapper& pHandler )
+        { return pHandler.ptr.lock()->viewAdded( rView ); } );
 }
 
 void EventMultiplexer::notifyViewRemoved( const UnoViewSharedPtr& rView )
@@ -1123,15 +1127,15 @@ void EventMultiplexer::notifyViewRemoved( const UnoViewSharedPtr& rView )
             mpImpl->mxListener.get() );
 
     mpImpl->maViewHandlers.applyAll(
-        [&rView]( const ViewEventHandlerWeakPtr& pHandler )
-        { return pHandler.lock()->viewRemoved( rView ); } );
+        [&rView]( const ViewEventHandlerWeakPtrWrapper& pHandler )
+        { return pHandler.ptr.lock()->viewRemoved( rView ); } );
 }
 
 void EventMultiplexer::notifyViewChanged( const UnoViewSharedPtr& rView )
 {
     mpImpl->maViewHandlers.applyAll(
-        [&rView]( const ViewEventHandlerWeakPtr& pHandler )
-        { return pHandler.lock()->viewChanged( rView ); } );
+        [&rView]( const ViewEventHandlerWeakPtrWrapper& pHandler )
+        { return pHandler.ptr.lock()->viewChanged( rView ); } );
 }
 
 void EventMultiplexer::notifyViewChanged( const uno::Reference<presentation::XSlideShowView>& xView )
@@ -1147,7 +1151,8 @@ void EventMultiplexer::notifyViewChanged( const uno::Reference<presentation::XSl
 void EventMultiplexer::notifyViewsChanged()
 {
     mpImpl->maViewHandlers.applyAll(
-        std::mem_fn( &ViewEventHandler::viewsChanged ));
+        []( const ViewEventHandlerWeakPtrWrapper& pHandler )
+        { return pHandler.ptr.lock()->viewsChanged(); } );
 }
 
 void EventMultiplexer::notifyViewClobbered(


More information about the Libreoffice-commits mailing list