diff options
author | Valerio Mariani <valerio.mariani@desy.de> | 2014-11-10 14:26:45 +0100 |
---|---|---|
committer | Thomas White <taw@physics.org> | 2014-11-10 18:59:34 +0100 |
commit | e3135a2154b1aa1c137664030972a09e50b7f1d8 (patch) | |
tree | d29d9afc83084411065b0219c3b0c43af551d53d /src/dw-hdfsee.c | |
parent | 44fa1b1c46f9cd52fb0f0842a09b1d499e3cf08c (diff) |
Copy and Replace when saving geometry
Diffstat (limited to 'src/dw-hdfsee.c')
-rw-r--r-- | src/dw-hdfsee.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/dw-hdfsee.c b/src/dw-hdfsee.c index f4655d0a..e9b6ee86 100644 --- a/src/dw-hdfsee.c +++ b/src/dw-hdfsee.c @@ -1176,7 +1176,7 @@ static gint displaywindow_about(GtkWidget *widget, DisplayWindow *dw) static int save_geometry_file(DisplayWindow *dw) { GtkWidget *d; - gchar * filename; + gchar * output_filename; int w; d = gtk_file_chooser_dialog_new("Save Detector Geometry", @@ -1187,10 +1187,11 @@ static int save_geometry_file(DisplayWindow *dw) NULL); gtk_dialog_run (GTK_DIALOG (d)); - filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER (d)); - w = write_detector_geometry(filename, dw->image->det); + output_filename = gtk_file_chooser_get_filename(GTK_FILE_CHOOSER (d)); + w = write_detector_geometry(dw->geom_filename, output_filename, + dw->image->det); gtk_widget_destroy(d); - g_free(filename); + g_free(output_filename); return w; } @@ -2429,7 +2430,8 @@ static gint displaywindow_keypress(GtkWidget *widget, GdkEventKey *event, } -DisplayWindow *displaywindow_open(char *filename, const char *peaks, +DisplayWindow *displaywindow_open(char *filename, char *geom_filename, + const char *peaks, double boost, int binning, int noisefilter, int calibmode, int colscale, const char *element, @@ -2479,6 +2481,7 @@ DisplayWindow *displaywindow_open(char *filename, const char *peaks, dw->multi_event = 0; dw->curr_event = 0; dw->ev_list = NULL; + dw->geom_filename = strdup(geom_filename); dw->image->det = det_geom; dw->image->beam = beam; @@ -2488,6 +2491,7 @@ DisplayWindow *displaywindow_open(char *filename, const char *peaks, dw->hdfile = hdfile_open(filename); if ( dw->hdfile == NULL ) { ERROR("Couldn't open file: %s\n", filename); + free(dw->geom_filename); free(dw); return NULL; } @@ -2502,6 +2506,7 @@ DisplayWindow *displaywindow_open(char *filename, const char *peaks, if ( dw->ev_list == NULL ) { ERROR("Error while parsing file structure\n"); free_event_list(dw->ev_list); + free(dw->geom_filename); free(dw); return NULL; } @@ -2509,6 +2514,7 @@ DisplayWindow *displaywindow_open(char *filename, const char *peaks, ERROR("Multi-event geometry file but no events found " "in data file\n"); free_event_list(dw->ev_list); + free(dw->geom_filename); free(dw); return NULL; } else { @@ -2532,8 +2538,9 @@ DisplayWindow *displaywindow_open(char *filename, const char *peaks, } if ( check ) { ERROR("Couldn't load file\n"); - free(dw); + free(dw->geom_filename); hdfile_close(dw->hdfile); + free(dw->geom_filename); return NULL; } |