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

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 56e14813fba9f70be6f557dbe4c90fb33d5ede0a..f7db354fee43ed4584b7678a7bcbbb06dd929c03 100644 (file)
@@ -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;
 
index 4c80ac6c7bd20d6af769bd4c4babc239f400bb56..caea8c8f8ef5cf53e21dcde4d5d14facf5370f5f 100644 (file)
@@ -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);
index 728a36d7aed7c19fcad644e2981ffa2a384bce55..284fd5cb6c8400368666a24b1627c72d9cd42aa3 100644 (file)
@@ -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); 
index b9ea1ac10329278f53f8b5c1c8b04c9dae4fcf79..ba4f9aba5ebbe4861b9db93959b23dcd86afa0a6 100644 (file)
@@ -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);
index de649ab4e72230859032945ed950ba9f8aa0d49d..d52c1b456c1d07d6d2718586d83d9a016d38afcf 100644 (file)
@@ -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); 
index 11869695780c524b41424cb55bdb48231b8ee939..8ba53161b2aa20f307016af4c38b21054ce1d1de 100644 (file)
@@ -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);
index d10a1590db4231e49e769df075d65d02b82b881f..e89ecf7c77f5586e1cb3cb068e1ce49c513da2bd 100644 (file)
@@ -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);
index 3c196327bdde772482af5e093801d9d9f90b5c42..ab26252795d93d6a644733c7d9673f00866abdb0 100644 (file)
@@ -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); 
index 324169d0e3856ac586f4f03b766d5e8add037979..616aea51f3c7f6b8d76ec92721db7748154da7c5 100644 (file)
@@ -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");
 }