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

New commits:
commit 5fa5a6b4353d47ab286e16e72bd4c440a95b2bdb
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Fri May 13 13:19:47 2022 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Fri May 13 17:56:25 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/+/134280
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>

diff --git a/vcl/unx/gtk3/gtkinst.cxx b/vcl/unx/gtk3/gtkinst.cxx
index a2439b683923..38f8d3c3d7d2 100644
--- a/vcl/unx/gtk3/gtkinst.cxx
+++ b/vcl/unx/gtk3/gtkinst.cxx
@@ -14724,8 +14724,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