[Libreoffice-commits] core.git: 2 commits - include/svl svl/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Mon Oct 1 06:15:48 UTC 2018


 include/svl/broadcast.hxx       |    1 +
 include/svl/listener.hxx        |    1 +
 svl/source/notify/broadcast.cxx |    4 ----
 svl/source/notify/listener.cxx  |    1 +
 4 files changed, 3 insertions(+), 4 deletions(-)

New commits:
commit 3de097e028d1079b0f48f43fab843fe53d39ec5d
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sun Sep 30 08:40:48 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Oct 1 08:15:39 2018 +0200

    fix bug in SvtListener::CopyAllBroadcasters
    
    need to flush existing broadcasters before overwriting
    
    Change-Id: If570b838d0313ab7598b36ff8a32fc6d31dea92c
    Reviewed-on: https://gerrit.libreoffice.org/61151
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/svl/listener.hxx b/include/svl/listener.hxx
index d6dc7b0cddbb..5ba14aea953e 100644
--- a/include/svl/listener.hxx
+++ b/include/svl/listener.hxx
@@ -55,6 +55,7 @@ public:
     bool EndListening( SvtBroadcaster& rBroadcaster );
     void EndListeningAll();
 
+    /// Overwrites existing broadcasters with the ones from the specified listener
     void CopyAllBroadcasters( const SvtListener& r );
     bool HasBroadcaster() const;
 
diff --git a/svl/source/notify/listener.cxx b/svl/source/notify/listener.cxx
index 506647784451..c668397baa47 100644
--- a/svl/source/notify/listener.cxx
+++ b/svl/source/notify/listener.cxx
@@ -90,6 +90,7 @@ void SvtListener::EndListeningAll()
 
 void SvtListener::CopyAllBroadcasters( const SvtListener& r )
 {
+    EndListeningAll();
     BroadcastersType aCopy(r.maBroadcasters);
     maBroadcasters.swap(aCopy);
     BroadcastersType::iterator it = maBroadcasters.begin();
commit 8e56287a931b7fbc2fd645e0d5592212965b8d04
Author:     Noel Grandin <noelgrandin at gmail.com>
AuthorDate: Sun Sep 30 08:40:23 2018 +0200
Commit:     Noel Grandin <noel.grandin at collabora.co.uk>
CommitDate: Mon Oct 1 08:15:26 2018 +0200

    SvtBroadcaster no need to unique
    
    SvtListener already enforces this
    
    Change-Id: I0389668af12013addfdbeec7a5e92a9d374193dc
    Reviewed-on: https://gerrit.libreoffice.org/61150
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/include/svl/broadcast.hxx b/include/svl/broadcast.hxx
index 934f591c3ba7..b4c8be5f9ac0 100644
--- a/include/svl/broadcast.hxx
+++ b/include/svl/broadcast.hxx
@@ -74,6 +74,7 @@ public:
     void PrepareForDestruction();
 
 private:
+    /// contains only one of each listener, which is enforced by SvtListener
     mutable ListenersType maListeners;
 
     /// When the broadcaster is about to die, collect listeners that asked for removal.
diff --git a/svl/source/notify/broadcast.cxx b/svl/source/notify/broadcast.cxx
index d91a94610d8f..145aa81b22b5 100644
--- a/svl/source/notify/broadcast.cxx
+++ b/svl/source/notify/broadcast.cxx
@@ -28,16 +28,12 @@ void SvtBroadcaster::Normalize() const
     if (!mbNormalized)
     {
         std::sort(maListeners.begin(), maListeners.end());
-        ListenersType::iterator itUniqueEnd = std::unique(maListeners.begin(), maListeners.end());
-        maListeners.erase(itUniqueEnd, maListeners.end());
         mbNormalized = true;
     }
 
     if (!mbDestNormalized)
     {
         std::sort(maDestructedListeners.begin(), maDestructedListeners.end());
-        ListenersType::iterator itUniqueEnd = std::unique(maDestructedListeners.begin(), maDestructedListeners.end());
-        maDestructedListeners.erase(itUniqueEnd, maDestructedListeners.end());
         mbDestNormalized = true;
     }
 }


More information about the Libreoffice-commits mailing list