summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2022-05-13 13:19:47 +0100
committerAdolfo Jayme Barrientos <fitojb@ubuntu.com>2022-05-18 10:41:46 +0200
commit425c1e3f31b49049ad8a6985d4c11e325b7e4750 (patch)
treecb9b5b16ceacdd16c3b2136a9aeaf2734e444afb
parent6767a309b7c3ddd283a83bcf7dc36fecaf9cc6b9 (diff)
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 <fitojb@ubuntu.com>
-rw-r--r--vcl/unx/gtk3/gtkinst.cxx10
1 files changed, 8 insertions, 2 deletions
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();