vcl/unx/gtk3/gtkinst.cxx |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

New commits:
commit 425c1e3f31b49049ad8a6985d4c11e325b7e4750
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri May 13 13:19:47 2022 +0100
Commit:     Adolfo Jayme Barrientos <fit...@ubuntu.com>
CommitDate: Wed May 18 10:41:46 2022 +0200

    Related: tdf#148197 gtk_tree_view_scroll_to_cell needs either path or column
    
    so a null path is invalid here
    
    Change-Id: I1958e9695e3290e0c513bce89c9548908860754f
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134187
    Tested-by: Jenkins
    Reviewed-by: Adolfo Jayme Barrientos <fit...@ubuntu.com>

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index 9c6327d7c4f7..e29a1bfb77f3 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -14552,8 +14552,14 @@ public:
     virtual void set_cursor(int pos) override
     {
         disable_notify_events();
-        GtkTreePath* path = pos != -1 ? gtk_tree_path_new_from_indices(pos, 
-1) : nullptr;
-        gtk_tree_view_scroll_to_cell(m_pTreeView, path, nullptr, false, 0, 0);
+        GtkTreePath* path;
+        if (pos != -1)
+        {
+            path = gtk_tree_path_new_from_indices(pos, -1);
+            gtk_tree_view_scroll_to_cell(m_pTreeView, path, nullptr, false, 0, 
0);
+        }
+        else
+            path = gtk_tree_path_new();
         gtk_tree_view_set_cursor(m_pTreeView, path, nullptr, false);
         gtk_tree_path_free(path);
         enable_notify_events();

Reply via email to