From 09b269e0b7b6e2f197234e64cf6486711d996d03 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Mon, 18 Jan 2010 06:28:14 +0100 Subject: [PATCH] main.c: Fix a crash when clearing a profile In the case the user has generated a profile and then is pressing the swipe button we will crash. This is because the selection_changed callback will be called and we try to access the profile and then will crash. Change the code to check for n_bytes only after we have checked if there is a selection. This is fixing the crash. --- src/main.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index 551ed43..02b19ed 100644 --- a/src/main.c +++ b/src/main.c @@ -390,7 +390,7 @@ profile_selection_changed (GtkTreeSelection *selection, ProcessWindow *pwin) GPtrArray *caller_list; ProfileDescendantTree *descendant_tree; int i; - int n_samples = pwin->profile->n_bytes; + int n_samples; int old_sort_column; GtkSortType old_sort_type; gboolean was_sorted; @@ -401,6 +401,7 @@ profile_selection_changed (GtkTreeSelection *selection, ProcessWindow *pwin) return; } + n_samples = pwin->profile->n_bytes; gtk_tree_model_get (GTK_TREE_MODEL (store), &selected, PROFILE_FUNC_FUNC, &func, -1); -- 2.11.4.GIT