From ebcead4a3ec7b2b105329fa0e382d7035d08ad48 Mon Sep 17 00:00:00 2001 From: compudj Date: Mon, 25 Jul 2005 20:41:14 +0000 Subject: [PATCH] filter fix git-svn-id: http://ltt.polymtl.ca/svn@973 04897980-b3bd-0310-b5e0-8ef037075253 --- ltt/branches/poly/lttv/lttv/filter.c | 12 +++++++++--- .../modules/gui/lttvwindow/lttvwindow/callbacks.c | 5 +---- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/ltt/branches/poly/lttv/lttv/filter.c b/ltt/branches/poly/lttv/lttv/filter.c index 11358657..daa00769 100644 --- a/ltt/branches/poly/lttv/lttv/filter.c +++ b/ltt/branches/poly/lttv/lttv/filter.c @@ -1042,7 +1042,9 @@ lttv_filter_tree_clone(const LttvFilterTree* tree) { */ LttvFilter* lttv_filter_clone(const LttvFilter* filter) { - + + if(!filter) return NULL; + LttvFilter* newfilter = g_new(LttvFilter,1); strcpy(newfilter->expression,filter->expression); @@ -1486,8 +1488,12 @@ lttv_filter_update(LttvFilter* filter) { void lttv_filter_destroy(LttvFilter* filter) { - g_free(filter->expression); - lttv_filter_tree_destroy(filter->head); + if(!filter) return; + + if(filter->expression) + g_free(filter->expression); + if(filter->head) + lttv_filter_tree_destroy(filter->head); g_free(filter); } diff --git a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c index d30a490d..5ded4686 100644 --- a/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c +++ b/ltt/branches/poly/lttv/modules/gui/lttvwindow/lttvwindow/callbacks.c @@ -4122,10 +4122,7 @@ Tab* create_tab(MainWindow * mw, Tab *copy_tab, /* Copy the previous tab's filter */ /* We can clone the filter, as we copy the trace set also */ /* The filter must always be in sync with the trace set */ - if(copy_tab->filter != NULL) - tab->filter = lttv_filter_clone(copy_tab->filter); - else - tab->filter = NULL; + tab->filter = lttv_filter_clone(copy_tab->filter); } else { tab->traceset_info->traceset = lttv_traceset_new(); -- 2.34.1