kernelshark: stop segfaults

From: Randy Dunlap
Date: Thu Apr 08 2010 - 18:58:19 EST


From: Randy Dunlap <randy.dunlap@xxxxxxxxxx>

Keep kernelshark from segfaulting when there is no open trace file.
It segfaults in:
Filter->graph events
Filter->graph advanced event
Filter->list CPUs

Signed-off-by: Randy Dunlap <randy.dunlap@xxxxxxxxxx>
---
kernel-shark.c | 3 +++
trace-filter.c | 6 ++++++
2 files changed, 9 insertions(+)

--- trace-cmd-0.7.0.orig/kernel-shark.c
+++ trace-cmd-0.7.0/kernel-shark.c
@@ -309,6 +309,9 @@ cpus_clicked (gpointer data)
gboolean all_cpus;
guint64 *cpu_mask;

+ if (!info->handle)
+ return;
+
store = TRACE_VIEW_STORE(gtk_tree_view_get_model(trace_tree));

all_cpus = trace_view_store_get_all_cpus(store);
--- trace-cmd-0.7.0.orig/trace-filter.c
+++ trace-cmd-0.7.0/trace-filter.c
@@ -717,6 +717,9 @@ void trace_adv_filter_dialog(struct trac
GtkWidget *view;
GtkWidget *event_box;

+ if (!handle)
+ return;
+
helper = g_malloc(sizeof(*helper));
g_assert(helper);

@@ -1762,6 +1765,9 @@ void trace_filter_event_filter_dialog(st
gchar **systems;
gint *event_ids;

+ if (!handle)
+ return;
+
trace_filter_convert_filter_to_names(filter, &systems, &event_ids);

filter_event_dialog(handle, filter, all_events, systems,
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/