svl/source/items/macitem.cxx |    4 ++++
 1 file changed, 4 insertions(+)

New commits:
commit 1806691c91b45b3ee5a52efc585930c41c705127
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Thu Sep 7 11:15:03 2023 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Thu Sep 7 13:47:54 2023 +0200

    tdf#141123: impossible to replace an event after it has been set
    
    Change-Id: Iabecd5b4cff803e45fede6b25db03d553eb835a9
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/156651
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/svl/source/items/macitem.cxx b/svl/source/items/macitem.cxx
index 4dae21dd4fc9..0b242c7cffa8 100644
--- a/svl/source/items/macitem.cxx
+++ b/svl/source/items/macitem.cxx
@@ -233,6 +233,10 @@ bool SvxMacroItem::GetPresentation
 
 void SvxMacroItem::SetMacro( SvMacroItemId nEvent, const SvxMacro& rMacro )
 {
+    // tdf#141123: emplace doesn't replace the element in the map if already 
exists
+    // see https://en.cppreference.com/w/cpp/container/map/emplace
+    // so first erase the macro if there's one for this event
+    aMacroTable.Erase(nEvent);
     aMacroTable.Insert( nEvent, rMacro);
 }
 

Reply via email to