[Libreoffice-commits] core.git: vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Thu Nov 26 15:49:46 UTC 2020
vcl/unx/gtk3/gtk3gtkinst.cxx | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
New commits:
commit ae6e7be84ed377ac63f01fdea323c0d6ee909514
Author: Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Nov 26 09:18:41 2020 +0000
Commit: Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu Nov 26 16:48:57 2020 +0100
keep toolitem ids unique
which is a problem when we swap item ids under SAL_RTL_ENABLED=1
in sidebars
Change-Id: Ib949f7836893b2f06b748fc3a2546788555782ca
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/106662
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm at redhat.com>
diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx
index af7653b71e57..1863076ddfcf 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -8577,11 +8577,22 @@ public:
virtual void set_item_ident(int nIndex, const OString& rIdent) override
{
- m_aMap.erase(m_aMap.find(get_item_ident(nIndex)));
+ OString sOldIdent(get_item_ident(nIndex));
+ m_aMap.erase(m_aMap.find(sOldIdent));
GtkToolItem* pItem = gtk_toolbar_get_nth_item(m_pToolbar, nIndex);
gtk_buildable_set_name(GTK_BUILDABLE(pItem), rIdent.getStr());
+ // to keep the ids unique, if the new id is already in use by an item,
+ // change the id of that item to the now unused old ident of this item
+ auto aFind = m_aMap.find(rIdent);
+ if (aFind != m_aMap.end())
+ {
+ GtkToolItem* pDupIdItem = aFind->second;
+ gtk_buildable_set_name(GTK_BUILDABLE(pDupIdItem), sOldIdent.getStr());
+ m_aMap[sOldIdent] = pDupIdItem;
+ }
+
m_aMap[rIdent] = pItem;
}
More information about the Libreoffice-commits
mailing list