Index: src/hid_attrib.h =================================================================== --- src/hid_attrib.h (revision 11985) +++ src/hid_attrib.h (revision 11986) @@ -26,11 +26,11 @@ PCB_HATT_LABEL, PCB_HATT_INTEGER, PCB_HATT_REAL, - PCB_HATT_STRING, /* WARNING: must be malloc()'d, can't be a (const char *) */ + PCB_HATT_STRING, /* WARNING: string, must be malloc()'d, can't be a (const char *) */ PCB_HATT_BOOL, PCB_HATT_ENUM, PCB_HATT_MIXED, - PCB_HATT_PATH, /* WARNING: must be malloc()'d, can't be a (const char *) */ + PCB_HATT_PATH, /* WARNING: string, must be malloc()'d, can't be a (const char *) */ PCB_HATT_UNIT, PCB_HATT_COORD, PCB_HATT_BUTTON, /* push button; default value is the label */ @@ -45,6 +45,9 @@ #define PCB_HATT_IS_COMPOSITE(type) \ (((type) >= PCB_HATT_BEGIN_HBOX) && ((type) < PCB_HATT_END)) +#define PCB_HAT_IS_STR(type) \ + ((type == PCB_HATT_STRING) || (type == PCB_HATT_PATH)) + /* alternative field names in struct pcb_hid_attribute_s */ #define pcb_hatt_flags max_val #define pcb_hatt_table_cols min_val Index: src_plugins/hid_lesstif/dialogs.c =================================================================== --- src_plugins/hid_lesstif/dialogs.c (revision 11985) +++ src_plugins/hid_lesstif/dialogs.c (revision 11986) @@ -948,8 +948,10 @@ if (attrs[i].help_text != ATTR_UNDOCUMENTED) ctx->actual_nattrs++; results[i] = attrs[i].default_val; - if (results[i].str_value) + if (PCB_HAT_IS_STR(attrs[i].type) && (results[i].str_value)) results[i].str_value = pcb_strdup(results[i].str_value); + else + results[i].str_value = NULL; } ctx->wl = (Widget *) calloc(n_attrs, sizeof(Widget)); Index: src_plugins/lib_gtk_common/dlg_attribute.c =================================================================== --- src_plugins/lib_gtk_common/dlg_attribute.c (revision 11985) +++ src_plugins/lib_gtk_common/dlg_attribute.c (revision 11986) @@ -576,8 +576,10 @@ int i; for (i = 0; i < ctx->n_attrs; i++) { ctx->results[i] = ctx->attrs[i].default_val; - if (ctx->results[i].str_value) + if (PCB_HAT_IS_STR(ctx->attrs[i].type) && (ctx->results[i].str_value)) ctx->results[i].str_value = pcb_strdup(ctx->results[i].str_value); + else + ctx->results[i].str_value = NULL; } }