aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-07-01 14:27:58 +0200
committerThomas White <taw@physics.org>2020-07-29 18:53:44 +0200
commit3a5729a9a99fbf9c640bb34da2d70f8a41af006c (patch)
tree8e960c7881ed7ee29302f67405bb697dfb14ab03
parentddcabc213f1110e312f042c11fcd553358ac9af7 (diff)
crystal_image_view_set_image: Free peak lists
-rw-r--r--src/crystfelimageview.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/crystfelimageview.c b/src/crystfelimageview.c
index cde4459c..be14ce9f 100644
--- a/src/crystfelimageview.c
+++ b/src/crystfelimageview.c
@@ -839,8 +839,19 @@ int crystfel_image_view_set_image(CrystFELImageView *iv,
const char *filename,
const char *event)
{
+ int i;
+
free(iv->filename);
free(iv->event);
+
+ /* Dump peak lists, because image is changing */
+ for ( i=0; i<iv->num_peaklists; i++ ) {
+ image_feature_list_free(iv->peaklists[i]);
+ }
+ free(iv->peaklists);
+ iv->peaklists = NULL;
+ iv->num_peaklists = 0;
+
iv->filename = safe_strdup(filename);
iv->event = safe_strdup(event);
return reload_image(iv);