From: <gi...@gp...> - 2011-06-19 20:45:34
|
The branch, master has been updated via 6f9fa46f0fbd0127a15f94a69649bafcff039690 (commit) from 7416c85d9f3c575d01298446960569840e7deef5 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. ========= Summary ========= src/hid/gerber/gerber.c | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) ================= Commit Messages ================= commit 6f9fa46f0fbd0127a15f94a69649bafcff039690 Author: Andrew Poelstra <as...@sf...> Commit: Andrew Poelstra <as...@sf...> Set file pointer to NULL after closing in gerber.c Closes-bug: lp-795734 When cleaning up the gerber HID, I had changed the file pointer used in maybe_close_f from a global to a (local) argument -- which made the line ``f = NULL'' effectively a no-op. However, the global variable f does need to be set to NULL for the code to recognize that the file is closed; otherwise it tries to keep using the (now invalid) file handle, causing crashes whenever the gerber HID is used more than once. This is now done after every call to maybe_close_f(), rather than depending on the function itself to have side effects. :100644 100644 f949d42... 5a4d84c... M src/hid/gerber/gerber.c ========= Changes ========= commit 6f9fa46f0fbd0127a15f94a69649bafcff039690 Author: Andrew Poelstra <as...@sf...> Commit: Andrew Poelstra <as...@sf...> Set file pointer to NULL after closing in gerber.c Closes-bug: lp-795734 When cleaning up the gerber HID, I had changed the file pointer used in maybe_close_f from a global to a (local) argument -- which made the line ``f = NULL'' effectively a no-op. However, the global variable f does need to be set to NULL for the code to recognize that the file is closed; otherwise it tries to keep using the (now invalid) file handle, causing crashes whenever the gerber HID is used more than once. This is now done after every call to maybe_close_f(), rather than depending on the function itself to have side effects. diff --git a/src/hid/gerber/gerber.c b/src/hid/gerber/gerber.c index f949d42..5a4d84c 100644 --- a/src/hid/gerber/gerber.c +++ b/src/hid/gerber/gerber.c @@ -162,9 +162,9 @@ deinitApertureList (ApertureList *list) Aperture *next; while (search) { + next = search->next; free(search); search = next; - next = search->next; } initApertureList (list); } @@ -176,6 +176,7 @@ static void resetApertures() deinitApertureList (&layer_aptr_list[i]); free (layer_aptr_list); layer_aptr_list = NULL; + curr_aptr_list = NULL; layer_list_max = 0; layer_list_idx = 0; } @@ -396,7 +397,6 @@ maybe_close_f (FILE *f) fprintf (f, "M02*\r\n"); fclose (f); } - f = NULL; } static BoxType region; @@ -585,6 +585,7 @@ gerber_do_export (HID_Attr_Val * options) memcpy (LayerStack, saved_layer_stack, sizeof (LayerStack)); maybe_close_f (f); + f = NULL; hid_restore_layer_ons (save_ons); PCB->Flags = save_thindraw; } @@ -689,6 +690,7 @@ gerber_set_layer (const char *name, int group, int empty) return 0; maybe_close_f (f); + f = NULL; pagecount++; assign_file_suffix (filesuff, idx); |