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 --- qt-ui/divelistview.cpp | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) (limited to 'qt-ui') diff --git a/qt-ui/divelistview.cpp b/qt-ui/divelistview.cpp index 57ad3f21f..78186ecd0 100644 --- a/qt-ui/divelistview.cpp +++ b/qt-ui/divelistview.cpp @@ -775,19 +775,12 @@ void DiveListView::loadImages() updateLastImageTimeOffset(shiftDialog.amount()); Q_FOREACH(const QString& fileName, fileNames) { - picture *p = alloc_picture(); - p->filename = qstrdup(fileName.toUtf8().data()); - picture_load_exif_data(p); - - if (p->timestamp) - p->timestamp += shiftDialog.amount(); // TODO: this should be cached and passed to the C-function int j = 0; struct dive *dive; for_each_dive (j, dive) { if (!dive->selected) continue; - dive_add_picture(dive, p); - dive_set_geodata_from_picture(dive, p); + dive_create_picture(dive, qstrdup(fileName.toUtf8().data()), shiftDialog.amount()); } } -- cgit v1.2.3-70-g09d2