Bugs item #3196584, was opened at 2011-03-01 17:11 Message generated for change (Comment added) made by thepurlieu You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=409538&aid=3196584&group_id=33921
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Drill Parser Group: None >Status: Closed >Resolution: Fixed Priority: 5 Private: No Submitted By: Nobody/Anonymous (nobody) >Assigned to: Julian Lamb (thepurlieu) Summary: Exporting drill file without any layers crashes gerbv Initial Comment: When I try to export an Excellon drill file, before I open any layers, gerbv crashes with a segmentation fault. To reproduce: 1. Start gerbv 2. Select "File" - "Export" - "Excellon drill ..." from the menu. 3. Choose a file name 4. gerbv crashes ---------------------------------------------------------------------- >Comment By: Julian Lamb (thepurlieu) Date: 2011-03-02 09:54 Message: Thanks for catching and looking into this. After looking at the issue, I decided to just do the work and grey out all the menu items that are unusable with no layers open. This will prevent the user from even being able to try the export. Please feel free to checkout the git version and make sure it works. Cheers! Julian ---------------------------------------------------------------------- Comment By: Simon Bichler (bartmonster) Date: 2011-03-01 18:32 Message: Here is a patch to fix this bug. It seems I can't attach it as a file, as I was not logged in when I submitted the bug report. >From a8fbbc2119980cdd3aa7d5195c90dac6b1d305f3 Mon Sep 17 00:00:00 2001 From: Simon Bichler <bichl...@panzergarage.de> Date: Tue, 1 Mar 2011 23:38:51 +0100 Subject: [PATCH] Fixes bug #3196584 by displaying an error message when trying to export a layer although, no layer is selected. --- src/callbacks.c | 44 +++++++++++++++++++++++++++++++------------- 1 files changed, 31 insertions(+), 13 deletions(-) diff --git a/src/callbacks.c b/src/callbacks.c index 3efb09c..4f0857f 100644 --- a/src/callbacks.c +++ b/src/callbacks.c @@ -499,25 +499,43 @@ callbacks_generic_save_activate (GtkMenuItem *menuitem, filename); else if (processType == CALLBACKS_SAVE_LAYER_AS) { gint index=callbacks_get_selected_row_index(); - - gerbv_save_layer_from_index (mainProject, index, filename); - /* rename the file path in the index, so future saves will reference the new file path */ - g_free (mainProject->file[index]->fullPathname); - mainProject->file[index]->fullPathname = g_strdup (filename); - g_free (mainProject->file[index]->name); - mainProject->file[index]->name = g_path_get_basename (filename); + if (index >= 0) { + gerbv_save_layer_from_index (mainProject, index, filename); + /* rename the file path in the index, so future saves will reference the new file path */ + g_free (mainProject->file[index]->fullPathname); + mainProject->file[index]->fullPathname = g_strdup (filename); + g_free (mainProject->file[index]->name); + mainProject->file[index]->name = g_path_get_basename (filename); + } else { + interface_show_alert_dialog("No layer selected", + NULL, + FALSE, + NULL); + } } else if (processType == CALLBACKS_SAVE_FILE_RS274X) { gint index=callbacks_get_selected_row_index(); - - gerbv_export_rs274x_file_from_image (filename, mainProject->file[index]->image, - &mainProject->file[index]->transform); + if (index >= 0) { + gerbv_export_rs274x_file_from_image (filename, mainProject->file[index]->image, + &mainProject->file[index]->transform); + } else { + interface_show_alert_dialog("No layer selected", + NULL, + FALSE, + NULL); + } } else if (processType == CALLBACKS_SAVE_FILE_DRILL) { gint index=callbacks_get_selected_row_index(); - - gerbv_export_drill_file_from_image (filename, mainProject->file[index]->image, - &mainProject->file[index]->transform); + if (index >= 0) { + gerbv_export_drill_file_from_image (filename, mainProject->file[index]->image, + &mainProject->file[index]->transform); + } else { + interface_show_alert_dialog("No layer selected", + NULL, + FALSE, + NULL); + } } /**create new image.... */ else if (processType == CALLBACKS_SAVE_FILE_RS274XM) { gerbv_image_t *image; -- 1.7.2.3 ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=409538&aid=3196584&group_id=33921 ------------------------------------------------------------------------------ Free Software Download: Index, Search & Analyze Logs and other IT data in Real-Time with Splunk. Collect, index and harness all the fast moving IT data generated by your applications, servers and devices whether physical, virtual or in the cloud. Deliver compliance at lower cost and gain new business insights. http://p.sf.net/sfu/splunk-dev2dev _______________________________________________ Gerbv-devel mailing list Gerbv-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gerbv-devel