aboutsummaryrefslogtreecommitdiff
path: root/src/crystfelimageview.c
diff options
context:
space:
mode:
authorThomas White <taw@physics.org>2020-03-02 15:59:58 +0100
committerThomas White <taw@physics.org>2020-07-29 18:42:24 +0200
commit7832232ae74501f08f1d530a332e7c573785c89e (patch)
tree14293d579b765978adbdeb27fb3010dacd4bcd57 /src/crystfelimageview.c
parent563a446d5d7d8c334e801ce427b28a0cfd46474e (diff)
Load image list and implement stepping back/forward
Diffstat (limited to 'src/crystfelimageview.c')
-rw-r--r--src/crystfelimageview.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/crystfelimageview.c b/src/crystfelimageview.c
index 028c381e..65698a64 100644
--- a/src/crystfelimageview.c
+++ b/src/crystfelimageview.c
@@ -372,6 +372,7 @@ GtkWidget *crystfel_image_view_new()
iv->zoom = 1.0;
iv->filename = NULL;
iv->event = NULL;
+ iv->image = NULL;
g_signal_connect(G_OBJECT(iv), "destroy",
G_CALLBACK(destroy_sig), iv);
@@ -465,12 +466,14 @@ static int reload_image(CrystFELImageView *iv)
/* Free old stuff */
if ( iv->image != NULL ) {
- image_free(iv->image);
- if ( iv->image->detgeom != NULL ) {
- for ( i=0; iv->image->detgeom->n_panels; iv++ ) {
- gdk_pixbuf_unref(iv->pixbufs[i]);
+ if ( (iv->image->detgeom != NULL) && (iv->pixbufs != NULL) ) {
+ for ( i=0; i<iv->image->detgeom->n_panels; i++ ) {
+ if ( iv->pixbufs[i] != NULL ) {
+ gdk_pixbuf_unref(iv->pixbufs[i]);
+ }
}
}
+ image_free(iv->image);
}
iv->image = image_read(iv->dtempl, iv->filename, iv->event);