When handing off a picture to a worker thread, copy it first

as otherwise we crash when the picture is freed before the
worker thread (to load from the net or to compute hashes)
is finished

Signed-off-by: Robert C. Helling <helling@atdotde.de>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Robert C. Helling 2016-03-15 21:31:59 +01:00 committed by Dirk Hohndel
parent 3c7e14a18f
commit 8a59d78faa
5 changed files with 30 additions and 6 deletions

View file

@ -376,6 +376,7 @@ struct picture {
for (struct picture *picture = (_divestruct).picture_list; picture; picture = picture->next)
extern struct picture *alloc_picture();
extern struct picture *clone_picture(struct picture *src);
extern bool dive_check_picture_time(struct dive *d, int shift_time, timestamp_t timestamp);
extern void dive_create_picture(struct dive *d, char *filename, int shift_time, bool match_all);
extern void dive_add_picture(struct dive *d, struct picture *newpic);
@ -385,6 +386,7 @@ extern bool picture_check_valid(char *filename, int shift_time);
extern void picture_load_exif_data(struct picture *p);
extern timestamp_t picture_get_timestamp(char *filename);
extern void dive_set_geodata_from_picture(struct dive *d, struct picture *pic);
extern void picture_free(struct picture *picture);
extern int explicit_first_cylinder(struct dive *dive, struct divecomputer *dc);
extern int get_depth_at_time(struct divecomputer *dc, unsigned int time);