From baa1dbd80859f17dfffcb2d1d306ec7c35b7285d Mon Sep 17 00:00:00 2001 From: Jan Ziak <0xe2.0x9a.0x9b@xfce.org> Date: Sat, 17 Dec 2022 21:40:22 +0000 Subject: [PATCH] Fix process filter crash caused by the use of an uninitialized variable gtk_tree_view_get_visible_range() documentation states the following: "Returns TRUE if valid paths were placed in start_path and end_path" Closes: https://gitlab.xfce.org/apps/xfce4-taskmanager/-/issues/71 Fixes: 8500675125ef2d5d1835d89828154c7781291cf9 --- src/process-window.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/process-window.c b/src/process-window.c index e937a8e..bd16c40 100644 --- a/src/process-window.c +++ b/src/process-window.c @@ -268,13 +268,13 @@ xtm_process_window_unstick_view_cursor (GtkTreeView *tree_view, XtmProcessWindow if (! window->view_stuck) return; - gtk_tree_view_get_cursor (tree_view, &cursor, NULL); - gtk_tree_view_get_visible_range (tree_view, NULL, &end); - if (gtk_tree_path_compare (cursor, end) >= 0) - window->view_stuck = FALSE; - - gtk_tree_path_free (cursor); - gtk_tree_path_free (end); + if (gtk_tree_view_get_visible_range (tree_view, NULL, &end)) { + gtk_tree_view_get_cursor (tree_view, &cursor, NULL); + if (cursor != NULL && gtk_tree_path_compare (cursor, end) >= 0) + window->view_stuck = FALSE; + gtk_tree_path_free (cursor); + gtk_tree_path_free (end); + } } static void