From b35f143788cd8154d5231475ce52d88d2544f384 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Thu, 30 Jul 2020 15:00:18 +0200 Subject: partialator: Fix deep copy of image structure --- src/partialator.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/partialator.c b/src/partialator.c index f35d7cf8..959338ca 100644 --- a/src/partialator.c +++ b/src/partialator.c @@ -920,6 +920,33 @@ static void write_logs_parallel(Crystal **crystals, int n_crystals, } +static struct detgeom *copy_detgeom(const struct detgeom *old) +{ + struct detgeom *new; + int np; + int i; + + new = malloc(sizeof(struct detgeom)); + if ( new == NULL ) return NULL; + + np = old->n_panels; + new->panels = malloc(np * sizeof(struct detgeom_panel)); + if ( new->panels == NULL ) { + free(new); + return NULL; + } + + new->n_panels = np; + + for ( i=0; ipanels[i] = old->panels[i]; + new->panels[i].name = strdup(old->panels[i].name); + } + + return new; +} + + int main(int argc, char *argv[]) { int c; @@ -1439,6 +1466,14 @@ int main(int argc, char *argv[]) image_for_crystal->crystals = &crystals[n_crystals]; image_for_crystal->filename = strdup(image->filename); + image_for_crystal->ev = safe_strdup(image->ev); + image_for_crystal->detgeom = copy_detgeom(image->detgeom); + image_for_crystal->features = NULL; + image_for_crystal->spectrum = NULL; + image_for_crystal->copied_headers = NULL; + image_for_crystal->dp = NULL; + image_for_crystal->bad = NULL; + image_for_crystal->sat = NULL; /* This is the raw list of reflections */ cr_refl = crystal_get_reflections(cr); -- cgit v1.2.3