Bug 505015

Summary: dataChanged() called with an invalid index range:
Product: [Applications] kphotoalbum Reporter: willem <whobers>
Component: BackendAssignee: KPhotoAlbum Bugs <kphotoalbum-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: johannes, rsquared42
Priority: NOR    
Version First Reported In: GIT master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description willem 2025-05-30 14:01:24 UTC
SUMMARY
Opening "Exif information and file metadata" dialogue produces invalid index range message in cli

STEPS TO REPRODUCE
1. In kphotoalbum select "Tokens"
2. right click on the media thumbnail (in my case it's a video)
3. 

OBSERVED RESULT
cli shows several recurring messages about invalid index range

EXPECTED RESULT
no such invalid index range

SOFTWARE/OS VERSIONS
MESA-INTEL: warning: Haswell Vulkan support is incomplete
Operating System: EndeavourOS 
KDE Plasma Version: 6.3.5
KDE Frameworks Version: 6.14.0
Qt Version: 6.9.0
Kernel Version: 6.12.30-1-lts (64-bit)
Graphics Platform: Wayland
Processors: 4 × Intel® Core™ i5-4570R CPU @ 2.70GHz
Memory: 7.7 GiB of RAM
Graphics Processor: Intel® Iris® Pro Graphics 5200

ADDITIONAL INFORMATION
this happens in othe dialogues as well; see https://bugs.kde.org/show_bug.cgi?id=504812
Comment 1 willem 2025-05-30 14:02:21 UTC
Sorry, forgot to add the cli output. 

QImage::scaled: Image is a null image
dataChanged() called with an invalid index range:
    topleft: QModelIndex(-1,-1,0x0,QObject(0x0))
    bottomRight:QModelIndex(-1,-1,0x0,QObject(0x0))
QImage::scaled: Image is a null image
dataChanged() called with an invalid index range:
    topleft: QModelIndex(-1,-1,0x0,QObject(0x0))
    bottomRight:QModelIndex(-1,-1,0x0,QObject(0x0))
QImage::scaled: Image is a null image
dataChanged() called with an invalid index range:
    topleft: QModelIndex(-1,-1,0x0,QObject(0x0))
    bottomRight:QModelIndex(-1,-1,0x0,QObject(0x0))
QImage::scaled: Image is a null image
dataChanged() called with an invalid index range:
    topleft: QModelIndex(-1,-1,0x0,QObject(0x0))
    bottomRight:QModelIndex(-1,-1,0x0,QObject(0x0))
QImage::scaled: Image is a null image
dataChanged() called with an invalid index range:
    topleft: QModelIndex(-1,-1,0x0,QObject(0x0))
    bottomRight:QModelIndex(-1,-1,0x0,QObject(0x0))
QImage::scaled: Image is a null image
dataChanged() called with an invalid index range:
    topleft: QModelIndex(-1,-1,0x0,QObject(0x0))
    bottomRight:QModelIndex(-1,-1,0x0,QObject(0x0))
dataChanged() called with an invalid index range:
    topleft: QModelIndex(-1,-1,0x0,QObject(0x0))
    bottomRight:QModelIndex(-1,-1,0x0,QObject(0x0))

these are the messages after viewing 1 media item.
Comment 2 Bug Janitor Service 2025-10-23 03:02:16 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/kphotoalbum/-/merge_requests/50
Comment 3 Bug Janitor Service 2025-10-23 17:57:55 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/kphotoalbum/-/merge_requests/51
Comment 4 Bug Janitor Service 2025-10-26 17:45:28 UTC
A possibly relevant merge request was started @ https://invent.kde.org/graphics/kphotoalbum/-/merge_requests/52
Comment 5 Johannes Zarl-Zierl 2025-11-04 20:48:20 UTC
Git commit 12282f3f34b6b1213232e54355a6c40558ed4c45 by Johannes Zarl-Zierl, on behalf of Randall Rude.
Committed on 04/11/2025 at 20:48.
Pushed by johanneszarl into branch 'master'.

Don't updateCell for a new thumbnail

Here's another scenario that logs "dataChanged() called with an invalid index range":
* start a fresh demo
* open the thumbnail view
* add at least one new image in the demo folder
* rescan for new images - the message is logged once per new image

This patch only triggers dataChanged() when a thumbnail is updated, not when a new thumbnail is inserted into the cache.

M  +11   -1    lib/kpathumbnails/TestThumbnailCache.cpp
M  +9    -2    lib/kpathumbnails/ThumbnailCache.cpp
M  +5    -4    lib/kpathumbnails/ThumbnailCache.h

https://invent.kde.org/graphics/kphotoalbum/-/commit/12282f3f34b6b1213232e54355a6c40558ed4c45