Bug 473587 - KPhotoAlbum crashes when switching to Image after resizing Viewer window while viewing Video
Summary: KPhotoAlbum crashes when switching to Image after resizing Viewer window whil...
Alias: None
Product: kphotoalbum
Classification: Applications
Component: Viewer (show other bugs)
Version: GIT master
Platform: openSUSE Linux
: NOR crash
Target Milestone: ---
Assignee: KPhotoAlbum Bugs
Depends on:
Reported: 2023-08-21 01:22 UTC by Victor Lobo
Modified: 2023-08-22 02:20 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Note You need to log in before you can comment on or make changes to this bug.
Description Victor Lobo 2023-08-21 01:22:41 UTC
KPhotoAlbum crashes if all these conditions are met:
1. Thumbnail Viewer has at least two videos at the start (top) followed by a mix of images and/or videos, and
2. User opens in Viewer any Video, and
3. User resizes the Viewer window while viewing Video, and
4. User then moves from Video to an Image

1. Open KPhotoAlbum
2. Ensure that the Thumbnail View has at least two videos at the start (top) followed by a mix of images and/or videos
3. Open any Video in the Thumbnail View in Viewer
4. While viewing Video, resize the Viewer window (for example by using mouse to drag window edges or click maximize window button)
5. Scroll to an Image in the Viewer (using mouse wheel, Pg-up/down or trackpad)
6. KPhotoAlbum crashes


No crash

Linux: openSUSE Tumbleweed 20230816; Kernel Version: 6.4.9-1-default (64-bit)
KDE Plasma Version: 5.27.7
KDE Frameworks Version: 5.108.0
Qt Version: 5.15.10
KPhotoAlbum Version 5.11.0 (as installed from Opensuse Tumbleweed repository)
Also occurs in latest git version v5.11.0-63-g26012c0b

1. This bug is likely a duplicate of Bug 472610. I cannot tell for sure if thats the same issue since my issue seems to require more steps.
2. Crash is reproducible every time the steps are followed.
3. Crash occurs even in the demo database. However, by default the demo database has only a single video, movie.avi. To easily setup the demo database for this bug do the following:
3a. Open demo database
3b. Go to /tmp/kphotoalbum-demo-<user>/
3c. Make a copy of movie.avi in the same folder; so now there will be two videos
3d. Maintenance --> Rescan for image and videos in demo database
3e. In Thumbnail Viewer, select the two videos and drag them to the very start of the Thumbnail view
3f. Then follow Step to Reproduce above from #3

GDB Backtrace:
Application: KPhotoAlbum (kphotoalbum), signal: Segmentation fault

[KCrash Handler]
#4  0x00000000004724fe in QString::QString (this=0x7ffdfb37a710, other=...) at /usr/include/qt5/QtCore/qstring.h:1093
#5  0x00000000004b1d33 in DB::FileName::FileName (this=0x7ffdfb37a710) at /home/victor/Downloads/kphotoalbum/lib/kpabase/FileName.h:21
#6  0x000000000058df8f in DB::ImageInfo::fileName (this=0x0) at /home/victor/Downloads/kphotoalbum/DB/ImageInfo.cpp:166
#7  0x00000000004e8ff3 in Viewer::ImageDisplay::pixmapLoaded (this=0x2decd20, request=0x30737b0, image=...) at /home/victor/Downloads/kphotoalbum/Viewer/ImageDisplay.cpp:478
#8  0x000000000063faba in BackgroundJobs::HandleVideoThumbnailRequestJob::sendResult (this=0x30b19a0, image=...) at /home/victor/Downloads/kphotoalbum/BackgroundJobs/HandleVideoThumbnailRequestJob.cpp:90
#9  0x000000000063f471 in BackgroundJobs::HandleVideoThumbnailRequestJob::frameLoaded (this=0x30b19a0, image=...) at /home/victor/Downloads/kphotoalbum/BackgroundJobs/HandleVideoThumbnailRequestJob.cpp:56
#10 0x000000000063f2a4 in BackgroundJobs::HandleVideoThumbnailRequestJob::execute (this=0x30b19a0) at /home/victor/Downloads/kphotoalbum/BackgroundJobs/HandleVideoThumbnailRequestJob.cpp:46
#11 0x00000000006367d6 in BackgroundTaskManager::JobInterface::start (this=0x30b19a0) at /home/victor/Downloads/kphotoalbum/BackgroundTaskManager/JobInterface.cpp:34
#12 0x0000000000636fed in BackgroundTaskManager::JobManager::execute (this=0x2a653f0) at /home/victor/Downloads/kphotoalbum/BackgroundTaskManager/JobManager.cpp:60
#13 0x0000000000637092 in BackgroundTaskManager::JobManager::addJob (this=0x2a653f0, job=0x30b19a0) at /home/victor/Downloads/kphotoalbum/BackgroundTaskManager/JobManager.cpp:67
#14 0x0000000000560000 in ImageManager::AsyncLoader::loadVideo (this=0x2b55730, request=0x30737b0) at /home/victor/Downloads/kphotoalbum/ImageManager/AsyncLoader.cpp:116
#15 0x000000000055fec0 in ImageManager::AsyncLoader::load (this=0x2b55730, request=0x30737b0) at /home/victor/Downloads/kphotoalbum/ImageManager/AsyncLoader.cpp:93
#16 0x00000000004eaec0 in Viewer::ImageDisplay::requestImage (this=0x2decd20, info=..., priority=false) at /home/victor/Downloads/kphotoalbum/Viewer/ImageDisplay.cpp:689
#17 0x00000000004e9c81 in Viewer::ImageDisplay::updatePreload (this=0x2decd20) at /home/victor/Downloads/kphotoalbum/Viewer/ImageDisplay.cpp:550
#18 0x00000000004e6ae8 in Viewer::ImageDisplay::resizeEvent (this=0x2decd20, event=0x7ffdfb37af30) at /home/victor/Downloads/kphotoalbum/Viewer/ImageDisplay.cpp:145
#19 0x00007ff1af9e734a in QWidget::event (this=0x2decd20, event=0x7ffdfb37af30) at kernel/qwidget.cpp:8835
#20 0x00007ff1af9a519e in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x2decd20, e=0x7ffdfb37af30) at kernel/qapplication.cpp:3640
#21 0x00007ff1aeced568 in QCoreApplication::notifyInternal2 (receiver=0x2decd20, event=0x7ffdfb37af30) at kernel/qcoreapplication.cpp:1064
#22 0x00007ff1aeced72e in QCoreApplication::sendEvent (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1462
#23 0x00007ff1af9dee86 in QWidgetPrivate::sendPendingMoveAndResizeEvents (this=this@entry=0x2e46780, recursive=recursive@entry=false, disableUpdates=<optimized out>, disableUpdates@entry=false) at kernel/qwidget.cpp:7737
#24 0x00007ff1af9e3883 in QWidgetPrivate::show_helper (this=this@entry=0x2e46780) at kernel/qwidget.cpp:7788
#25 0x00007ff1af9e6813 in QWidgetPrivate::setVisible (this=0x2e46780, visible=<optimized out>) at kernel/qwidget.cpp:8137
#26 0x00007ff1af9cb340 in QStackedLayout::setCurrentIndex (this=0x2ba7720, index=0) at kernel/qstackedlayout.cpp:323
#27 0x00000000004d5bb1 in Viewer::ViewerWidget::load (this=0x2e518b0) at /home/victor/Downloads/kphotoalbum/Viewer/ViewerWidget.cpp:462
#28 0x00000000004d64bf in Viewer::ViewerWidget::showNextN (this=0x2e518b0, n=1) at /home/victor/Downloads/kphotoalbum/Viewer/ViewerWidget.cpp:548
#29 0x00000000004d64e3 in Viewer::ViewerWidget::showNext (this=0x2e518b0) at /home/victor/Downloads/kphotoalbum/Viewer/ViewerWidget.cpp:554
#30 0x00000000004d87fe in Viewer::ViewerWidget::wheelEvent (this=0x2e518b0, event=0x7ffdfb37b3a0) at /home/victor/Downloads/kphotoalbum/Viewer/ViewerWidget.cpp:1087
#31 0x00007ff1af9e6d68 in QWidget::event (this=this@entry=0x2e518b0, event=event@entry=0x7ffdfb37b3a0) at kernel/qwidget.cpp:9045
#32 0x00007ff1afa91f7e in QFrame::event (this=0x2e518b0, e=0x7ffdfb37b3a0) at widgets/qframe.cpp:550
#33 0x00007ff1af9a519e in QApplicationPrivate::notify_helper (this=this@entry=0x25b2c90, receiver=receiver@entry=0x2e518b0, e=e@entry=0x7ffdfb37b3a0) at kernel/qapplication.cpp:3640
#34 0x00007ff1af9adffe in QApplication::notify (this=<optimized out>, receiver=<optimized out>, e=0x7ffdfb37b560) at kernel/qapplication.cpp:3192
#35 0x00007ff1aeced568 in QCoreApplication::notifyInternal2 (receiver=0x2e51df0, event=0x7ffdfb37b560) at kernel/qcoreapplication.cpp:1064
#36 0x00007ff1aeced5b2 in QCoreApplication::forwardEvent (receiver=<optimized out>, event=<optimized out>, originatingEvent=<optimized out>) at kernel/qcoreapplication.cpp:1079
#37 0x00007ff1afa013db in QWidgetWindow::handleWheelEvent (this=this@entry=0x30713d0, event=event@entry=0x7ffdfb37b730) at kernel/qwidgetwindow.cpp:889
#38 0x00007ff1afa02e70 in QWidgetWindow::event (this=0x30713d0, event=0x7ffdfb37b730) at kernel/qwidgetwindow.cpp:327
#39 0x00007ff1af9a519e in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x30713d0, e=0x7ffdfb37b730) at kernel/qapplication.cpp:3640
#40 0x00007ff1aeced568 in QCoreApplication::notifyInternal2 (receiver=0x30713d0, event=0x7ffdfb37b730) at kernel/qcoreapplication.cpp:1064
#41 0x00007ff1aeced73e in QCoreApplication::sendSpontaneousEvent (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1474
#42 0x00007ff1af178b17 in QGuiApplicationPrivate::processWheelEvent (e=0x3076970) at kernel/qguiapplication.cpp:2371
#43 0x00007ff1af15036c in QWindowSystemInterface::sendWindowSystemEvents (flags=flags@entry=...) at kernel/qwindowsysteminterface.cpp:1169
#44 0x00007ff1a351b1aa in xcbSourceDispatch (source=<optimized out>) at qxcbeventdispatcher.cpp:105
#45 0x00007ff1ab9169b8 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#46 0x00007ff1ab916dc8 in ?? () from /lib64/libglib-2.0.so.0
#47 0x00007ff1ab916e5c in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#48 0x00007ff1aed464a6 in QEventDispatcherGlib::processEvents (this=0x2697470, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#49 0x00007ff1aecebffb in QEventLoop::exec (this=this@entry=0x7ffdfb37b9d0, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#50 0x00007ff1aecf4490 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#51 0x0000000000471840 in main (argc=2, argv=0x7ffdfb37c0d8) at /home/victor/Downloads/kphotoalbum/main.cpp:161
[Inferior 1 (process 17245) detached]
Comment 1 Johannes Zarl-Zierl 2023-08-21 19:53:48 UTC
Thanks for the excellent bug report! I don't know how you manage to find these bugs, but you are doing a great job at making kphotoalbum better!
Comment 2 Johannes Zarl-Zierl 2023-08-21 20:41:58 UTC
Git commit 25224891c2ae3cadccc1ad4b0038ca99d9ae9438 by Johannes Zarl-Zierl.
Committed on 21/08/2023 at 22:35.
Pushed by johanneszarl into branch 'master'.

Fix crash when the viewer gets a decoded pixmap while no image is set.

When viewing both images and videos, the situation might arise when the
ImageDisplay has not yet been set to an image after a transition from a
video to an image, yet the pixmapLoaded slot receives an image for the
previous video file.
For images, this is not an issue, because there's already a valid image
set (and it is checked whether the filename matches that of the received

M  +3    -2    Viewer/AbstractDisplay.h
M  +15   -3    Viewer/ImageDisplay.cpp
M  +5    -4    Viewer/QtAVDisplay.cpp

Comment 3 Johannes Zarl-Zierl 2023-08-21 20:42:50 UTC
I think the bug should be fixed in the latest git master commit. Can you verify that the fix works for you?
Comment 4 Victor Lobo 2023-08-22 02:20:03 UTC
Thank you! I came across these bugs while evaluating KPA before introducing to my family. This particular bug I stumbled upon because I have a few Video files with a wrong file modify date of 12/31/79 which put them at the top in the thumbnail viewer 

Fix from the latest git master works well. Thank you!