Blame SOURCES/0001-Resolves-rhbz-2081661-gtk-critical-gtk_tree_view_scr.patch

7582f3
From 1dbfd248524789efa4a84dc94d56a229c19bc0b9 Mon Sep 17 00:00:00 2001
7582f3
From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= <caolanm@redhat.com>
7582f3
Date: Wed, 4 May 2022 11:52:58 +0100
7582f3
Subject: [PATCH] Resolves: rhbz#2081661 gtk-critical
7582f3
 gtk_tree_view_scroll_to_cell assertion
7582f3
7582f3
Change-Id: I4c7c4caed907072ef3a73ccfafabe882d618fa0e
7582f3
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133730
7582f3
Tested-by: Jenkins
7582f3
Reviewed-by: Adolfo Jayme Barrientos <fitojb@ubuntu.com>
7582f3
(cherry picked from commit 816435e4c2d52615462670464c48689bebdf1e55)
7582f3
---
7582f3
 cui/source/customize/SvxMenuConfigPage.cxx    | 2 +-
7582f3
 cui/source/customize/SvxToolbarConfigPage.cxx | 6 ++++--
7582f3
 2 files changed, 5 insertions(+), 3 deletions(-)
7582f3
7582f3
diff --git a/cui/source/customize/SvxMenuConfigPage.cxx b/cui/source/customize/SvxMenuConfigPage.cxx
7582f3
index 34cee1368d7a..bf7457193f5c 100644
7582f3
--- a/cui/source/customize/SvxMenuConfigPage.cxx
7582f3
+++ b/cui/source/customize/SvxMenuConfigPage.cxx
7582f3
@@ -136,7 +136,7 @@ void SvxMenuConfigPage::Init()
7582f3
 
7582f3
     ReloadTopLevelListBox();
7582f3
 
7582f3
-    m_xTopLevelListBox->set_active(0);
7582f3
+    m_xTopLevelListBox->set_active(m_xTopLevelListBox->get_count() ? 0 : -1);
7582f3
     SelectElement();
7582f3
 
7582f3
     m_xCommandCategoryListBox->Init(comphelper::getProcessComponentContext(), m_xFrame,
7582f3
diff --git a/cui/source/customize/SvxToolbarConfigPage.cxx b/cui/source/customize/SvxToolbarConfigPage.cxx
7582f3
index 99a85d82f96e..d2284428d8f1 100644
7582f3
--- a/cui/source/customize/SvxToolbarConfigPage.cxx
7582f3
+++ b/cui/source/customize/SvxToolbarConfigPage.cxx
7582f3
@@ -246,10 +246,12 @@ void SvxToolbarConfigPage::Init()
7582f3
 
7582f3
     ReloadTopLevelListBox();
7582f3
 
7582f3
-    sal_Int32 nPos = 0;
7582f3
+    sal_Int32 nCount = m_xTopLevelListBox->get_count();
7582f3
+    sal_Int32 nPos = nCount > 0 ? 0 : -1;
7582f3
+
7582f3
     if (!m_aURLToSelect.isEmpty())
7582f3
     {
7582f3
-        for (sal_Int32 i = 0, nCount = m_xTopLevelListBox->get_count(); i < nCount; ++i)
7582f3
+        for (sal_Int32 i = 0; i < nCount; ++i)
7582f3
         {
7582f3
             SvxConfigEntry* pData
7582f3
                 = reinterpret_cast<SvxConfigEntry*>(m_xTopLevelListBox->get_id(i).toInt64());
7582f3
-- 
7582f3
2.35.1
7582f3