From: Jim Evins Date: Thu, 5 Nov 2009 03:47:31 +0000 (-0500) Subject: Fixed merge inconsistencies and crash X-Git-Tag: glabels-2_3_0~139 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=8016d6f4fe8f4970ce615d53d2d541be6afef850;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 merge 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 56e14813..f7db354f 100644 --- a/src/merge.c +++ b/src/merge.c @@ -684,7 +684,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 4c80ac6c..caea8c8f 100644 --- a/src/object-editor-bc-page.c +++ b/src/object-editor-bc-page.c @@ -338,7 +338,7 @@ gl_object_editor_set_bc_color (glObjectEditor *editor, color_node->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 728a36d7..284fd5cb 100644 --- a/src/object-editor-data-page.c +++ b/src/object-editor-data-page.c @@ -153,7 +153,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 b9ea1ac1..ba4f9aba 100644 --- a/src/object-editor-fill-page.c +++ b/src/object-editor-fill-page.c @@ -141,7 +141,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 de649ab4..d52c1b45 100644 --- a/src/object-editor-image-page.c +++ b/src/object-editor-image-page.c @@ -157,7 +157,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 11869695..8ba53161 100644 --- a/src/object-editor-line-page.c +++ b/src/object-editor-line-page.c @@ -188,7 +188,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 d10a1590..e89ecf7c 100644 --- a/src/object-editor-shadow-page.c +++ b/src/object-editor-shadow-page.c @@ -228,7 +228,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 3c196327..ab262527 100644 --- a/src/object-editor-text-page.c +++ b/src/object-editor-text-page.c @@ -465,7 +465,7 @@ gl_object_editor_set_text_color (glObjectEditor *editor, text_color_node->color); } - if (!text_color_node->field_flag) { + if (!text_color_node->field_flag || !merge_flag) { gl_debug (DEBUG_EDITOR, "color field false"); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_color_radio), TRUE); diff --git a/src/xml-label.c b/src/xml-label.c index 324169d0..616aea51 100644 --- a/src/xml-label.c +++ b/src/xml-label.c @@ -819,13 +819,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"); }