From f53b5c4d3f5bcf396d9abaa72f0be31a3d5512dc Mon Sep 17 00:00:00 2001 From: Tomaz Canabrava Date: Tue, 3 Jun 2014 14:51:47 -0300 Subject: Fix linked list corruption, move code to C. The picture list is a single linked list where the pictures have a node to their next element. When adding the same picture to two dives, things got way way wrong and crashes were appearing. This will replicate the information (filename, latitude and longitude) for each dive that has the picture, BUT it still tries to save as much as possible on the actual pixmap. Signed-off-by: Tomaz Canabrava Signed-off-by: Dirk Hohndel --- dive.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'dive.c') diff --git a/dive.c b/dive.c index 065d45529..52a95ef80 100644 --- a/dive.c +++ b/dive.c @@ -2269,6 +2269,17 @@ struct picture *alloc_picture() return pic; } +void dive_create_picture(struct dive *d, char *filename, int shift_time) +{ + struct picture *p = alloc_picture(); + if (p->timestamp) + p->timestamp += shift_time; + p->filename = filename; + picture_load_exif_data(p); + dive_add_picture(d, p); + dive_set_geodata_from_picture(d, p); +} + void dive_add_picture(struct dive *d, struct picture *picture) { if (d->picture_list == NULL) { -- cgit v1.2.3-70-g09d2