vcl/unx/gtk3/gtk3gtkinst.cxx | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-)
New commits: commit ae6e7be84ed377ac63f01fdea323c0d6ee909514 Author: Caolán McNamara <caol...@redhat.com> AuthorDate: Thu Nov 26 09:18:41 2020 +0000 Commit: Caolán McNamara <caol...@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 <caol...@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; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits