Bug 474151 - KPhotoAlbum crashes when Annotations are not saved and then user right-clicks Show Info in Viewer
Summary: KPhotoAlbum crashes when Annotations are not saved and then user right-clicks...
Status: RESOLVED FIXED
Alias: None
Product: kphotoalbum
Classification: Applications
Component: Viewer (show other bugs)
Version: 5.11.0
Platform: openSUSE Linux
: NOR crash
Target Milestone: ---
Assignee: KPhotoAlbum Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-09-04 17:25 UTC by Victor Lobo
Modified: 2023-10-09 19:24 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 Victor Lobo 2023-09-04 17:25:14 UTC
SUMMARY
KPhotoAlbum crashes when Annotations are not saved and then user right-clicks Show Info in Viewer


STEPS TO REPRODUCE
1. Open KPhotoAlbum
2. Go to Thumbnail View
3. Go to Annotations window for any image or video (CTRL + 1)
4. Make some changes in Annotations window (for example select tag or change label) but do not save
5. Click Cancel on Annotations window
6. Click Discard on "Discard Changes?" popup dialog to return to Thumbnail Viewer (without saving any annotation changes)
7. Open any image or video in Viewer (press Enter)
8. Go to Show Info in the right-click context menu in Viewer. ("Discard Changes?" popup dialog is displayed)
9. Click Discard or Cancel in "Discard Changes?" popup dialog
10. Crash


OBSERVED RESULT
Crash

EXPECTED RESULT
No crash

SOFTWARE/OS VERSIONS
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-85-g805a99d2


ADDITIONAL INFORMATION
1. Crash is reproducible every time the steps are followed.
2. Crash occurs even in the demo database.
3. Crash occurs for Images and Videos.


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

[KCrash Handler]
#4  QMenuSloppyState::setSubMenuPopup (this=0x16f87e0, actionRect=..., resetAction=<optimized out>, subMenu=0x0) at widgets/qmenu.h:65
#5  0x00007f467fb2bdb0 in QMenu::internalDelayedPopup (this=0x2017630) at widgets/qmenu.cpp:3676
#6  0x00007f467ed1922b in QObject::event (this=0x2017630, e=0x7fffe25bb5d0) at kernel/qobject.cpp:1369
#7  0x00007f467f9a519e in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x2017630, e=0x7fffe25bb5d0) at kernel/qapplication.cpp:3640
#8  0x00007f467eced568 in QCoreApplication::notifyInternal2 (receiver=0x2017630, event=0x7fffe25bb5d0) at kernel/qcoreapplication.cpp:1064
#9  0x00007f467eced72e in QCoreApplication::sendEvent (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1462
#10 0x00007f467ed45899 in QTimerInfoList::activateTimers (this=0x1015770) at kernel/qtimerinfo_unix.cpp:643
#11 0x00007f467ed46144 in timerSourceDispatch (source=<optimized out>) at kernel/qeventdispatcher_glib.cpp:183
#12 0x00007f467b9169b8 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#13 0x00007f467b916dc8 in ?? () from /lib64/libglib-2.0.so.0
#14 0x00007f467b916e5c in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#15 0x00007f467ed464a6 in QEventDispatcherGlib::processEvents (this=0x1016f90, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#16 0x00007f467ecebffb in QEventLoop::exec (this=this@entry=0x7fffe25bb820, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#17 0x00007f467fb2b70f in QMenuPrivate::exec(QPoint const&, QAction*, std::function<QPoint (QSize const&)>) (this=0x16f8580, p=..., action=0x0, positionFunction=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#18 0x00007f467fb2b82f in QMenu::exec (this=<optimized out>, p=..., action=<optimized out>) at widgets/qmenu.cpp:2686
#19 0x00000000004d6387 in Viewer::ViewerWidget::contextMenuEvent (this=0x2ee4430, e=0x7fffe25bbac0) at /home/victor/Downloads/kphotoalbum/Viewer/ViewerWidget.cpp:531
#20 0x00007f467f9e6d68 in QWidget::event (this=this@entry=0x2ee4430, event=event@entry=0x7fffe25bbac0) at kernel/qwidget.cpp:9045
#21 0x00007f467fa91f7e in QFrame::event (this=0x2ee4430, e=0x7fffe25bbac0) at widgets/qframe.cpp:550
#22 0x00007f467f9a519e in QApplicationPrivate::notify_helper (this=this@entry=0xf31c90, receiver=receiver@entry=0x2ee4430, e=e@entry=0x7fffe25bbac0) at kernel/qapplication.cpp:3640
#23 0x00007f467f9adaaa in QApplication::notify (this=<optimized out>, receiver=<optimized out>, e=0x7fffe25bbcf0) at kernel/qapplication.cpp:3246
#24 0x00007f467eced568 in QCoreApplication::notifyInternal2 (receiver=0x1f0fcd0, event=0x7fffe25bbcf0) at kernel/qcoreapplication.cpp:1064
#25 0x00007f467eced5b2 in QCoreApplication::forwardEvent (receiver=<optimized out>, event=<optimized out>, originatingEvent=<optimized out>) at kernel/qcoreapplication.cpp:1079
#26 0x00007f467f9fff59 in QWidgetWindow::handleMouseEvent (this=this@entry=0x1f73a80, event=event@entry=0x7fffe25bbfe0) at kernel/qwidgetwindow.cpp:692
#27 0x00007f467fa02d1f in QWidgetWindow::event (this=0x1f73a80, event=0x7fffe25bbfe0) at kernel/qwidgetwindow.cpp:300
#28 0x00007f467f9a519e in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x1f73a80, e=0x7fffe25bbfe0) at kernel/qapplication.cpp:3640
#29 0x00007f467eced568 in QCoreApplication::notifyInternal2 (receiver=0x1f73a80, event=0x7fffe25bbfe0) at kernel/qcoreapplication.cpp:1064
#30 0x00007f467eced73e in QCoreApplication::sendSpontaneousEvent (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1474
#31 0x00007f467f17d0eb in QGuiApplicationPrivate::processMouseEvent (e=0x7f45e81bba90) at kernel/qguiapplication.cpp:2285
#32 0x00007f467f15036c in QWindowSystemInterface::sendWindowSystemEvents (flags=flags@entry=...) at kernel/qwindowsysteminterface.cpp:1169
#33 0x00007f467351b1aa in xcbSourceDispatch (source=<optimized out>) at qxcbeventdispatcher.cpp:105
#34 0x00007f467b9169b8 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
#35 0x00007f467b916dc8 in ?? () from /lib64/libglib-2.0.so.0
#36 0x00007f467b916e5c in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#37 0x00007f467ed464a6 in QEventDispatcherGlib::processEvents (this=0x1016f90, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#38 0x00007f467ecebffb in QEventLoop::exec (this=this@entry=0x7fffe25bc310, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#39 0x00007f467ecf4490 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#40 0x0000000000471860 in main (argc=2, argv=0x7fffe25bca18) at /home/victor/Downloads/kphotoalbum/main.cpp:161
[Inferior 1 (process 1406) detached]
Comment 1 Johannes Zarl-Zierl 2023-09-08 23:47:11 UTC
Git commit 7d035923cafb6418ae3d58f571c73a608e84fb30 by Johannes Zarl-Zierl.
Committed on 09/09/2023 at 01:44.
Pushed by johanneszarl into branch 'master'.

Fix crash when annotation dialog is closed without saving...

...and the user then opens the context menu in the viewer window.

M  +23   -2    AnnotationDialog/Dialog.cpp
M  +1    -1    AnnotationDialog/Dialog.h

https://invent.kde.org/graphics/kphotoalbum/-/commit/7d035923cafb6418ae3d58f571c73a608e84fb30
Comment 2 Johannes Zarl-Zierl 2023-09-08 23:48:21 UTC
Hi Victor!

I believe the bug is fixed by the latest commit...

Cheers,
  Johannes
Comment 3 Victor Lobo 2023-09-10 23:58:19 UTC
Hi Johannes,

Yes, this fixes the crash. However, I want to point out that when I make changes in the Annotations window and click Cancel, I am no longer prompted to save my changes. I assume this was intentional with the latest commit, but not sure. 

Thank you!
Victor
Comment 4 Johannes Zarl-Zierl 2023-09-11 19:47:23 UTC
Hi Victor,

No, that was not intentional, but a result of late-night coding...

Thanks for being thorough!

Cheers,
  Johannes
Comment 5 Johannes Zarl-Zierl 2023-09-11 20:44:50 UTC
Ok, now I know how this slipped through: I tried by marking a person (that is already there) on an image using a positionable tag. Having a change in positionable tags does still trigger the prompt. Adding a tag does not.
Comment 6 Victor Lobo 2023-09-30 16:13:27 UTC
Reopening this bug since the same crash still occurs in the following scenario in git master. 

STEPS TO REPRODUCE
1. Open KPhotoAlbum
2. Go to Thumbnail View
3. Go to Annotations window for any image or video (CTRL + 1)
4. Add a positionable tag in the Annotation Window
5. Click DONE in Annotations window
6. Open any image or video in Viewer (press Enter)
7. Go to Info in the right-click context menu in Viewer. ("Discard Changes?" popup dialog is displayed)
8. Click Discard or Cancel in "Discard Changes?" popup dialog
9. Crash
Comment 7 Johannes Zarl-Zierl 2023-10-02 21:02:19 UTC
Git commit a195619fcc1f0de68f41a86154eb0425f3605ffb by Johannes Zarl-Zierl.
Committed on 02/10/2023 at 22:56.
Pushed by johanneszarl into branch 'master'.

Fix crash when closing the annotation dialog with positionable tags

Make API harder to misuse by unsetting m_areasChanged in tidyAreas()
instead of doing this in the calling code.

M  +3    -4    AnnotationDialog/Dialog.cpp

https://invent.kde.org/graphics/kphotoalbum/-/commit/a195619fcc1f0de68f41a86154eb0425f3605ffb
Comment 8 Johannes Zarl-Zierl 2023-10-08 14:35:36 UTC
Hi Victor,
I think I fixed this with the a195619fcc1f0de68f41a86154eb0425f3605ffb commit and just forgot to close the bug.
Can you verify that the bug is now fixed for you?
Cheers,
  Johannes
Comment 9 Victor Lobo 2023-10-08 23:28:22 UTC
This bug is fixed. Thank you Johannes. Please close it.
Comment 10 Johannes Zarl-Zierl 2023-10-09 19:24:14 UTC
Thanks for the confirmation!