Commit 8136f977 authored by Aurélien Gâteau's avatar Aurélien Gâteau
Browse files

Check mCurrentItem validity before emitting any signal with it

Fix the rare case where item is reset while the thumbnail is being generated
by the thumbnail thread.

BUG: 302136
FIXED-IN: 2.9.1
parent fab9e37d
......@@ -700,6 +700,10 @@ void ThumbnailLoadJob::startCreatingThumbnail(const QString& pixPath)
void ThumbnailLoadJob::slotGotPreview(const KFileItem& item, const QPixmap& pixmap)
{
if (mCurrentItem.isNull()) {
// This can happen if current item has been removed by removeItems()
return;
}
LOG(mCurrentItem.url());
QSize size;
emit thumbnailLoaded(item, pixmap, size);
......@@ -707,6 +711,10 @@ void ThumbnailLoadJob::slotGotPreview(const KFileItem& item, const QPixmap& pixm
void ThumbnailLoadJob::emitThumbnailLoaded(const QImage& img, const QSize& size)
{
if (mCurrentItem.isNull()) {
// This can happen if current item has been removed by removeItems()
return;
}
LOG(mCurrentItem.url());
QPixmap thumb = QPixmap::fromImage(img);
emit thumbnailLoaded(mCurrentItem, thumb, size);
......@@ -714,6 +722,10 @@ void ThumbnailLoadJob::emitThumbnailLoaded(const QImage& img, const QSize& size)
void ThumbnailLoadJob::emitThumbnailLoadingFailed()
{
if (mCurrentItem.isNull()) {
// This can happen if current item has been removed by removeItems()
return;
}
LOG(mCurrentItem.url());
emit thumbnailLoadingFailed(mCurrentItem);
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment