View | Details | Raw Unified
Collapse All | Expand All

(-) digikam-0.9.0-beta1.orig/digikam/digikam/imagepreviewjob.cpp (+6 lines)
 Lines 173-178    Link Here 
        stream >> width >> height >> depth;
        stream >> width >> height >> depth;
        preview = QImage(d->shmaddr, width, height, depth,
        preview = QImage(d->shmaddr, width, height, depth,
                         0, 0, QImage::IgnoreEndian);
                         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
    else
    {
    {
(-) digikam-0.9.0-beta1.orig/digikam/digikam/imagepreviewwidget.cpp (-5 / +19 lines)
 Lines 91-101    Link Here 
ImagePreviewWidget::~ImagePreviewWidget()
ImagePreviewWidget::~ImagePreviewWidget()
{
{
    if (!d->previewJob.isNull())
    if (d->previewJob)
        d->previewJob->kill();
        d->previewJob->kill();
    
    d->blinkPreviewTimer->stop();
    d->blinkPreviewTimer->stop();
            
    delete d;
    delete d;
}
}
 Lines 107-112    Link Here 
    d->previewBlink      = false;
    d->previewBlink      = false;
    d->blinkPreviewTimer->start(200);
    d->blinkPreviewTimer->start(200);
    if (d->previewJob)
        d->previewJob->kill();
    d->previewJob = new ImagePreviewJob(KURL(path), 1024, AlbumSettings::instance()->getExifRotate());
    d->previewJob = new ImagePreviewJob(KURL(path), 1024, AlbumSettings::instance()->getExifRotate());
    connect(d->previewJob, SIGNAL(signalImagePreview(const KURL&, const QImage&)),
    connect(d->previewJob, SIGNAL(signalImagePreview(const KURL&, const QImage&)),
 Lines 129-137    Link Here 
void ImagePreviewWidget::slotGotImagePreview(const KURL&, const QImage& preview)
void ImagePreviewWidget::slotGotImagePreview(const KURL&, const QImage& preview)
{
{
    d->blinkPreviewTimer->stop();
    d->blinkPreviewTimer->stop();
    d->previewJob = 0;    
    d->preview    = preview;
    d->preview    = preview;
    d->pixmap     = QPixmap(contentsRect().size());
    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();
    updatePixmap();
    repaint(false);
    repaint(false);
    emit previewComplete();
    emit previewComplete();
 Lines 140-146    Link Here 
void ImagePreviewWidget::slotFailedImagePreview(const KURL&)
void ImagePreviewWidget::slotFailedImagePreview(const KURL&)
{
{
    d->blinkPreviewTimer->stop();
    d->blinkPreviewTimer->stop();
    d->previewJob = 0;    
    if (d->previewJob)
        d->previewJob->kill();
    d->previewJob = 0;
    d->preview    = QImage();
    d->preview    = QImage();
    d->pixmap     = QPixmap(contentsRect().size());
    d->pixmap     = QPixmap(contentsRect().size());
    updatePixmap();
    updatePixmap();