Bug 472109 - "Sort selected by date" can be used to trigger a crash
Summary: "Sort selected by date" can be used to trigger a crash
Status: RESOLVED FIXED
Alias: None
Product: kphotoalbum
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KPhotoAlbum Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-07-09 21:33 UTC by Johannes Zarl-Zierl
Modified: 2023-07-09 22:08 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Johannes Zarl-Zierl 2023-07-09 21:33:56 UTC
SUMMARY

STEPS TO REPRODUCE
1.  Start kphotoalbum --demo
2. Set up preconditions for failure:
  a. Go to thumbnail view
  b. Select two images an create a stack
  c. Press "Refresh"
  d. Now the database has a stack
3. Select all images (using Ctrl-A)
4. Click "View | Expand all stacks"
5. No images are selected
6. Click "View | Sort selected by Date & Time"


OBSERVED RESULT
KPhotoAlbum crashes

EXPECTED RESULT
Menu entry "View | Sort selected by Date & Time" should have been disabled and clicking it should not have crashed the program.

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Johannes Zarl-Zierl 2023-07-09 22:08:47 UTC
Git commit 736882a98da8fefc56b7f3c4a2d2db68ce00ff67 by Johannes Zarl-Zierl.
Committed on 09/07/2023 at 22:04.
Pushed by johanneszarl into branch 'master'.

Prevent inconsistent UI when thumbnail model is reset

If an action like "Collaps all stacks" is called, the thumbnail model is
reset, thus invalidating the selection.
Unfortunately, this does not trigger a selectionChanged signal because
the selection is reset and not cleared.

This would lead to an inconsistent UI, where actions that depend on an
existing selection would not be disabled, despite there not being a
selection.

M  +13   -2    DB/ImageInfoList.cpp
M  +15   -3    ThumbnailView/ThumbnailWidget.cpp

https://invent.kde.org/graphics/kphotoalbum/-/commit/736882a98da8fefc56b7f3c4a2d2db68ce00ff67