From af70df1732fa8a56a2ff3319ed2ee4c255c72c61 Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Thu, 5 Jan 2006 07:01:33 +0000 Subject: [PATCH] 2006-01-05 Jim Evins * src/merge-properties-dialog.c: (src_changed_cb): Be extra paranoid before calling strcmp(). * src/merge.c: (gl_merge_set_src): Don't make (merge == NULL) a critical error. git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@580 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- glabels2/ChangeLog | 7 +++++++ glabels2/src/merge-properties-dialog.c | 5 ++++- glabels2/src/merge.c | 24 ++++++++++++++++++------ 3 files changed, 29 insertions(+), 7 deletions(-) diff --git a/glabels2/ChangeLog b/glabels2/ChangeLog index bea3ac54..e345e10f 100644 --- a/glabels2/ChangeLog +++ b/glabels2/ChangeLog @@ -1,3 +1,10 @@ +2006-01-05 Jim Evins + + * src/merge-properties-dialog.c: (src_changed_cb): + Be extra paranoid before calling strcmp(). + * src/merge.c: (gl_merge_set_src): + Don't make (merge == NULL) a critical error. + 2005-12-22 Jim Evins * src/glabels-batch.c: (main): diff --git a/glabels2/src/merge-properties-dialog.c b/glabels2/src/merge-properties-dialog.c index d7e22e33..c21f521a 100644 --- a/glabels2/src/merge-properties-dialog.c +++ b/glabels2/src/merge-properties-dialog.c @@ -486,7 +486,10 @@ src_changed_cb (GtkWidget *widget, gl_debug (DEBUG_MERGE, "orig=\"%s\", new=\"%s\"\n", orig_src, src); - if (!orig_src || strcmp (src, orig_src)) { + if (((orig_src == NULL) && (src != NULL)) || + ((orig_src != NULL) && (src == NULL)) || + ((orig_src != NULL) && (src != NULL) && strcmp (src, orig_src))) + { gl_merge_set_src (dialog->priv->merge, src); load_tree (dialog->priv->store, dialog->priv->merge); } diff --git a/glabels2/src/merge.c b/glabels2/src/merge.c index d902b31b..2bba656c 100644 --- a/glabels2/src/merge.c +++ b/glabels2/src/merge.c @@ -433,19 +433,30 @@ gl_merge_set_src (glMerge *merge, gl_debug (DEBUG_MERGE, "START"); - g_return_if_fail (merge && GL_IS_MERGE (merge)); + if (merge == NULL) + { + gl_debug (DEBUG_MERGE, "END (NULL)"); + return; + } - if ( src == NULL) { + g_return_if_fail (GL_IS_MERGE (merge)); - if ( merge->private->src != NULL ) { + if ( src == NULL) + { + + if ( merge->private->src != NULL ) + { g_free (merge->private->src); } merge->private->src = NULL; merge_free_record_list (&merge->private->record_list); - } else { + } + else + { - if ( merge->private->src != NULL ) { + if ( merge->private->src != NULL ) + { g_free(merge->private->src); } merge->private->src = g_strdup (src); @@ -453,7 +464,8 @@ gl_merge_set_src (glMerge *merge, merge_free_record_list (&merge->private->record_list); merge_open (merge); - while ( (record = merge_get_record (merge)) != NULL ) { + while ( (record = merge_get_record (merge)) != NULL ) + { record_list = g_list_append( record_list, record ); } merge_close (merge); -- 2.39.5