]> git.sur5r.net Git - glabels/commitdiff
Fixed merge inconsistencies and crash
authorJim Evins <evins@snaught.com>
Thu, 5 Nov 2009 04:00:42 +0000 (23:00 -0500)
committerJim Evins <evins@snaught.com>
Thu, 5 Nov 2009 04:00:42 +0000 (23:00 -0500)
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.

src/merge.c
src/object-editor-bc-page.c
src/object-editor-data-page.c
src/object-editor-fill-page.c
src/object-editor-image-page.c
src/object-editor-line-page.c
src/object-editor-shadow-page.c
src/object-editor-text-page.c
src/xml-label.c

index 8af027fc0cdf6ad1d9165769a85306707a8d664b..4eecac3ff010653def6a7245c4723846e00f241a 100644 (file)
@@ -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;
 
index 464029e053dfa71213a0b4ad71eb7113c9d74770..0216d6c395b089bfe8fc0eb81bf3e226be767a13 100644 (file)
@@ -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);
index 449d3e288efa25e8ca0c0bc49668ebff5151f3bf..1717845f6fb77ca8718a998f67971c280380b8fc 100644 (file)
@@ -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); 
index c40f8a170ee4be32803c4bae13da683743e6bf1d..4daedab2c4327def0ccf9394600599928acb0cdc 100644 (file)
@@ -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);
index a975ab292a0412cd069d84b22ffe5ea8f64857f6..1433913024865179020b8a625aca220ac965d370 100644 (file)
@@ -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); 
index a9daf766f826bd98a07298040f6e6d8dc5c461fb..c2f645088df27e3e4645df2ab44dab4961bac55c 100644 (file)
@@ -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);
index 4be309e9a9e9a5bfeff5beb52d8d9d9097fe231a..bf297da5f7e4774fb22b9c3f71f08047d3430a3b 100644 (file)
@@ -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);
index e8a463da2f6526378f3d292eb895f75b03cc6444..d28353127baacf7434b6695f25f7a24cae6bf068 100644 (file)
@@ -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);
index 0f8e104cc0ca861efcc927294c3bc362eaa36e1b..5a56d8cd77591a6152c11a5c9ffa6648e00ed561 100644 (file)
@@ -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");
 }