summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'media-gfx/digikam/files/digikam-0.9.0_beta1-memory-leak-fix.patch')
-rw-r--r--media-gfx/digikam/files/digikam-0.9.0_beta1-memory-leak-fix.patch71
1 files changed, 71 insertions, 0 deletions
diff --git a/media-gfx/digikam/files/digikam-0.9.0_beta1-memory-leak-fix.patch b/media-gfx/digikam/files/digikam-0.9.0_beta1-memory-leak-fix.patch
new file mode 100644
index 000000000000..450721daf61c
--- /dev/null
+++ b/media-gfx/digikam/files/digikam-0.9.0_beta1-memory-leak-fix.patch
@@ -0,0 +1,71 @@
+--- trunk/extragear/graphics/digikam/digikam/imagepreviewjob.cpp #567459:567460
+@@ -173,6 +173,12 @@
+ stream >> width >> height >> depth;
+ preview = QImage(d->shmaddr, width, height, depth,
+ 0, 0, QImage::IgnoreEndian);
++
++ // The buffer supplied to the QImage constructor above must remain valid
++ // throughout the lifetime of the object.
++ // This is not true, the shared memory will be freed or reused.
++ // If we pass the object around, we must do a deep copy.
++ preview = preview.copy();
+ }
+ else
+ {
+--- trunk/extragear/graphics/digikam/digikam/imagepreviewwidget.cpp #567459:567460
+@@ -91,11 +91,11 @@
+
+ ImagePreviewWidget::~ImagePreviewWidget()
+ {
+- if (!d->previewJob.isNull())
++ if (d->previewJob)
+ d->previewJob->kill();
+-
++
+ d->blinkPreviewTimer->stop();
+-
++
+ delete d;
+ }
+
+@@ -107,6 +107,9 @@
+ d->previewBlink = false;
+ d->blinkPreviewTimer->start(200);
+
++ if (d->previewJob)
++ d->previewJob->kill();
++
+ d->previewJob = new ImagePreviewJob(KURL(path), 1024, AlbumSettings::instance()->getExifRotate());
+
+ connect(d->previewJob, SIGNAL(signalImagePreview(const KURL&, const QImage&)),
+@@ -129,9 +132,16 @@
+ void ImagePreviewWidget::slotGotImagePreview(const KURL&, const QImage& preview)
+ {
+ d->blinkPreviewTimer->stop();
+- d->previewJob = 0;
+ d->preview = preview;
+ d->pixmap = QPixmap(contentsRect().size());
++
++ // It is very important to kill the thumbnail job properly
++ // so that is frees its shared memory. Otherwise the memory
++ // will _never_ be freed, see b.k.o. #131277
++ if (d->previewJob)
++ d->previewJob->kill();
++ d->previewJob = 0;
++
+ updatePixmap();
+ repaint(false);
+ emit previewComplete();
+@@ -140,7 +150,11 @@
+ void ImagePreviewWidget::slotFailedImagePreview(const KURL&)
+ {
+ d->blinkPreviewTimer->stop();
+- d->previewJob = 0;
++
++ if (d->previewJob)
++ d->previewJob->kill();
++ d->previewJob = 0;
++
+ d->preview = QImage();
+ d->pixmap = QPixmap(contentsRect().size());
+ updatePixmap();