[Libreoffice-commits] core.git: Branch 'libreoffice-7-1' - vcl/unx
Caolán McNamara (via logerrit)
logerrit at kemper.freedesktop.org
Thu Nov 26 15:50:13 UTC 2020
vcl/unx/gtk3/gtk3gtkinst.cxx | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
New commits:
commit 4ca69ed39178e3c22ecd77f122de7909a16a606c
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:49:28 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/+/106674
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 4e1fae380e90..5af961ed5aeb 100644
--- a/vcl/unx/gtk3/gtk3gtkinst.cxx
+++ b/vcl/unx/gtk3/gtk3gtkinst.cxx
@@ -8572,11 +8572,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