Bug 483266 - Segfault after deleting an image if the annotation dialog was previously accepted to remove a tag
Summary: Segfault after deleting an image if the annotation dialog was previously acce...
Status: RESOLVED FIXED
Alias: None
Product: kphotoalbum
Classification: Applications
Component: Annotation Dialog (show other bugs)
Version: GIT master
Platform: Other Linux
: NOR crash
Target Milestone: ---
Assignee: KPhotoAlbum Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-11 17:09 UTC by rsquared42
Modified: 2024-03-11 21:59 UTC (History)
1 user (show)

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 rsquared42 2024-03-11 17:09:38 UTC
STEPS TO REPRODUCE
1. Load the demo database.
2. Click Events, then click fun.
3. Select both images and open the annotation dialog with CTRL-2.
4. Unselect the "fun" event and click Done.
5. Now delete one or more images to trigger the segfault (eg. click Home, People, and select and delete an image).

OBSERVED RESULT
KPhotoAlbum segfaults.

EXPECTED RESULT
KPhotoAlbum shouldn't segfault.

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

ADDITIONAL INFORMATION
AnnotationDialog::Dialog::slotDiscardFiles() is calling AnnotationDialog::ImagePreviewWidget::reconfigure() even though the annotation dialog is closed.  AnnotationDialog::Dialog() is not clearing m_origList when it is accepted.
Comment 1 Tobias Leupold 2024-03-11 18:35:45 UTC
Thanks for your bug report! I can confirm this.

I'll have a look at this, if Johannes is not faster than me ;-)
Comment 2 Tobias Leupold 2024-03-11 20:25:49 UTC
Git commit 59f2cb63ac191040e6e7e0a20d5afe01396e5c82 by Tobias Leupold.
Committed on 11/03/2024 at 20:24.
Pushed by tleupold into branch 'master'.

Don't crash if an image is deleted whilst annotating multiple images

M  +6    -1    AnnotationDialog/ImagePreview.cpp
M  +2    -1    AnnotationDialog/ImagePreview.h
M  +18   -1    AnnotationDialog/ImagePreviewWidget.cpp

https://invent.kde.org/graphics/kphotoalbum/-/commit/59f2cb63ac191040e6e7e0a20d5afe01396e5c82
Comment 3 Tobias Leupold 2024-03-11 20:26:39 UTC
This was a nasty one ;-) Please check if this fixes it, and re-open if not!
Comment 4 rsquared42 2024-03-11 21:59:32 UTC
Wow, that was fast.  And it seems to be fixed.  Good work!