From: Jim Evins Date: Thu, 5 Nov 2009 04:00:42 +0000 (-0500) Subject: Fixed merge inconsistencies and crash X-Git-Tag: glabels-2_2_6~3 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a2ad57fa1a0c1e826ff1b758a3baeed263d4b1a8;p=glabels Fixed merge inconsistencies and crash merge.c: Fixed crash when trying to print when a "key" radio has been selected but no key has been selected yet. object-editor-*-page.c: Fixed potential inconsistencies with "key" radio buttons when a merge source has not been selected but the field indicates that it is using a merge key. This can happen when opening a glabels file that has a merg type not supported by the current instance of glabels. xml-label.c: Also when parsing a merge field that has a merge type not supported, don't continue parsing it. --- diff --git a/src/merge.c b/src/merge.c index 8af027fc..4eecac3f 100644 --- a/src/merge.c +++ b/src/merge.c @@ -685,7 +685,7 @@ gl_merge_eval_key (glMergeRecord *record, gl_debug (DEBUG_MERGE, "START"); - if ( (record != NULL) ) { + if ( (record != NULL) && (key != NULL) ) { for (p = record->field_list; p != NULL; p = p->next) { field = (glMergeField *) p->data; diff --git a/src/object-editor-bc-page.c b/src/object-editor-bc-page.c index 464029e0..0216d6c3 100644 --- a/src/object-editor-bc-page.c +++ b/src/object-editor-bc-page.c @@ -342,7 +342,7 @@ gl_object_editor_set_bc_color (glObjectEditor *editor, g_free (gdk_color); } - if (!color_node->field_flag) { + if (!color_node->field_flag || !merge_flag) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->bc_color_radio), TRUE); gtk_widget_set_sensitive (editor->priv->bc_color_combo, TRUE); diff --git a/src/object-editor-data-page.c b/src/object-editor-data-page.c index 449d3e28..1717845f 100644 --- a/src/object-editor-data-page.c +++ b/src/object-editor-data-page.c @@ -155,7 +155,7 @@ gl_object_editor_set_data (glObjectEditor *editor, gtk_widget_set_sensitive (editor->priv->data_key_radio, merge_flag); - if (!text_node->field_flag) { + if (!text_node->field_flag || !merge_flag) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->data_literal_radio), TRUE); diff --git a/src/object-editor-fill-page.c b/src/object-editor-fill-page.c index c40f8a17..4daedab2 100644 --- a/src/object-editor-fill-page.c +++ b/src/object-editor-fill-page.c @@ -143,7 +143,7 @@ gl_object_editor_set_fill_color (glObjectEditor *editor, } - if (!color_node->field_flag) { + if (!color_node->field_flag || !merge_flag) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->fill_color_radio), TRUE); gtk_widget_set_sensitive (editor->priv->fill_color_combo, TRUE); diff --git a/src/object-editor-image-page.c b/src/object-editor-image-page.c index a975ab29..14339130 100644 --- a/src/object-editor-image-page.c +++ b/src/object-editor-image-page.c @@ -159,7 +159,7 @@ gl_object_editor_set_image (glObjectEditor *editor, gtk_widget_set_sensitive (editor->priv->img_key_radio, merge_flag); - if (!text_node->field_flag) { + if (!text_node->field_flag || !merge_flag) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->img_file_radio), TRUE); diff --git a/src/object-editor-line-page.c b/src/object-editor-line-page.c index a9daf766..c2f64508 100644 --- a/src/object-editor-line-page.c +++ b/src/object-editor-line-page.c @@ -190,7 +190,7 @@ gl_object_editor_set_line_color (glObjectEditor *editor, } - if (!color_node->field_flag) { + if (!color_node->field_flag || !merge_flag) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->line_color_radio), TRUE); gtk_widget_set_sensitive (editor->priv->line_color_combo, TRUE); diff --git a/src/object-editor-shadow-page.c b/src/object-editor-shadow-page.c index 4be309e9..bf297da5 100644 --- a/src/object-editor-shadow-page.c +++ b/src/object-editor-shadow-page.c @@ -231,7 +231,7 @@ gl_object_editor_set_shadow_color (glObjectEditor *editor, } - if (!color_node->field_flag) { + if (!color_node->field_flag || !merge_flag) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->shadow_color_radio), TRUE); gtk_widget_set_sensitive (editor->priv->shadow_color_combo, TRUE); diff --git a/src/object-editor-text-page.c b/src/object-editor-text-page.c index e8a463da..d2835312 100644 --- a/src/object-editor-text-page.c +++ b/src/object-editor-text-page.c @@ -476,7 +476,7 @@ gl_object_editor_set_text_color (glObjectEditor *editor, g_free (gdk_color); } - if (!text_color_node->field_flag) { + if (!text_color_node->field_flag || !merge_flag) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_color_radio), TRUE); gtk_widget_set_sensitive (editor->priv->text_color_combo, TRUE); diff --git a/src/xml-label.c b/src/xml-label.c index 0f8e104c..5a56d8cd 100644 --- a/src/xml-label.c +++ b/src/xml-label.c @@ -809,13 +809,16 @@ xml_parse_merge_fields (xmlNodePtr node, merge = gl_merge_new (string); g_free (string); - string = lgl_xml_get_prop_string (node, "src", NULL); - gl_merge_set_src (merge, string); - g_free (string); + if (merge) + { + string = lgl_xml_get_prop_string (node, "src", NULL); + gl_merge_set_src (merge, string); + g_free (string); - gl_label_set_merge (label, merge); + gl_label_set_merge (label, merge); - g_object_unref (G_OBJECT(merge)); + g_object_unref (G_OBJECT(merge)); + } gl_debug (DEBUG_XML, "END"); }