aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-07-30 15:00:18 +0200
committerThomas White <taw@physics.org>2020-07-30 15:00:18 +0200
commitb35f143788cd8154d5231475ce52d88d2544f384 (patch)
tree3aee489074ccb2d4261372dd78d01a0333a8e426 /src
parent3d85005cacbc800e4cac89d01534da3d943b1874 (diff)
partialator: Fix deep copy of image structure
Diffstat (limited to 'src')
-rw-r--r--src/partialator.c35
1 files changed, 35 insertions, 0 deletions
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; i<np; i++ ) {
+ new->panels[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);