Bug 476561 - KPhotoAlbum crashes when changes in Annotation window are not saved and then user right clicks "Show" in Viewer window
Summary: KPhotoAlbum crashes when changes in Annotation window are not saved and then ...
Status: VERIFIED FIXED
Alias: None
Product: kphotoalbum
Classification: Applications
Component: Annotation Dialog (show other bugs)
Version: 5.11.0
Platform: openSUSE Linux
: NOR crash
Target Milestone: ---
Assignee: KPhotoAlbum Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-05 00:37 UTC by Victor Lobo
Modified: 2023-11-12 01:08 UTC (History)
2 users (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-11-05 00:37:14 UTC
SUMMARY
KPhotoAlbum crashes when changes in Annotation window are not saved and then user right clicks "Show" in Viewer window


STEPS TO REPRODUCE
1. Open KPhotoAlbum
2. Go to Thumbnail View
3. Open an Image/Video in Viewer window
4. Open Annotations window (Ctrl + 1)
5. Make some changes in Annotations window (but do cancel or save; keep the Annotations window open)
6. Go to open Viewer window and go to "Show" in right click context menu
7. Click Cancel or Discard in the "Discard Changes?"dialog box that comes up
8. Crash

OBSERVED RESULT
Crash

EXPECTED RESULT
No crash

SOFTWARE/OS VERSIONS
Linux: openSUSE Tumbleweed 20230906; Kernel Version: 6.4.12-1-default (64-bit)
KDE Plasma Version: 5.27.7
KDE Frameworks Version: 5.109.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-166-g7c4b2886


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=0x21ecb80, actionRect=..., resetAction=<optimized out>, subMenu=0x0) at widgets/qmenu.h:65
#5  0x00007fc1b2d2bdb0 in QMenu::internalDelayedPopup (this=0x24edfa0) at widgets/qmenu.cpp:3676
#6  0x00007fc1b1f1922b in QObject::event (this=0x24edfa0, e=0x7ffd33130830) at kernel/qobject.cpp:1369
#7  0x00007fc1b2ba519e in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x24edfa0, e=0x7ffd33130830) at kernel/qapplication.cpp:3640
#8  0x00007fc1b1eed568 in QCoreApplication::notifyInternal2 (receiver=0x24edfa0, event=0x7ffd33130830) at kernel/qcoreapplication.cpp:1064
#9  0x00007fc1b1eed72e in QCoreApplication::sendEvent (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1462
#10 0x00007fc1b1f45899 in QTimerInfoList::activateTimers (this=0x1b32030) at kernel/qtimerinfo_unix.cpp:643
#11 0x00007fc1b1f46144 in timerSourceDispatch (source=<optimized out>) at kernel/qeventdispatcher_glib.cpp:183
#12 0x00007fc1ae524ef0 in ?? () from /lib64/libglib-2.0.so.0
#13 0x00007fc1ae526b18 in ?? () from /lib64/libglib-2.0.so.0
#14 0x00007fc1ae5271cc in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#15 0x00007fc1b1f464a6 in QEventDispatcherGlib::processEvents (this=0x1b33940, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#16 0x00007fc1b1eebffb in QEventLoop::exec (this=this@entry=0x7ffd33130a80, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#17 0x00007fc1b2d2b70f in QMenuPrivate::exec(QPoint const&, QAction*, std::function<QPoint (QSize const&)>) (this=0x21ec920, p=..., action=0x0, positionFunction=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#18 0x00007fc1b2d2b82f in QMenu::exec (this=<optimized out>, p=..., action=<optimized out>) at widgets/qmenu.cpp:2686
#19 0x00000000004d7c81 in Viewer::ViewerWidget::contextMenuEvent (this=0x20ccee0, e=0x7ffd33130d20) at /home/victor/kphotoalbum/Viewer/ViewerWidget.cpp:561
#20 0x00007fc1b2be6d68 in QWidget::event (this=this@entry=0x20ccee0, event=event@entry=0x7ffd33130d20) at kernel/qwidget.cpp:9045
#21 0x00007fc1b2c91f7e in QFrame::event (this=0x20ccee0, e=0x7ffd33130d20) at widgets/qframe.cpp:550
#22 0x00007fc1b2ba519e in QApplicationPrivate::notify_helper (this=this@entry=0x1a591e0, receiver=receiver@entry=0x20ccee0, e=e@entry=0x7ffd33130d20) at kernel/qapplication.cpp:3640
#23 0x00007fc1b2badaaa in QApplication::notify (this=<optimized out>, receiver=<optimized out>, e=0x7ffd33130f50) at kernel/qapplication.cpp:3246
#24 0x00007fc1b1eed568 in QCoreApplication::notifyInternal2 (receiver=0x21ed160, event=0x7ffd33130f50) at kernel/qcoreapplication.cpp:1064
#25 0x00007fc1b1eed5b2 in QCoreApplication::forwardEvent (receiver=<optimized out>, event=<optimized out>, originatingEvent=<optimized out>) at kernel/qcoreapplication.cpp:1079
#26 0x00007fc1b2bfff59 in QWidgetWindow::handleMouseEvent (this=this@entry=0x2528a70, event=event@entry=0x7ffd33131240) at kernel/qwidgetwindow.cpp:692
#27 0x00007fc1b2c02d1f in QWidgetWindow::event (this=0x2528a70, event=0x7ffd33131240) at kernel/qwidgetwindow.cpp:300
#28 0x00007fc1b2ba519e in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x2528a70, e=0x7ffd33131240) at kernel/qapplication.cpp:3640
#29 0x00007fc1b1eed568 in QCoreApplication::notifyInternal2 (receiver=0x2528a70, event=0x7ffd33131240) at kernel/qcoreapplication.cpp:1064
#30 0x00007fc1b1eed73e in QCoreApplication::sendSpontaneousEvent (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1474
#31 0x00007fc1b237d0eb in QGuiApplicationPrivate::processMouseEvent (e=0x3d4c250) at kernel/qguiapplication.cpp:2285
#32 0x00007fc1b235036c in QWindowSystemInterface::sendWindowSystemEvents (flags=flags@entry=...) at kernel/qwindowsysteminterface.cpp:1169
#33 0x00007fc1a630f1aa in xcbSourceDispatch (source=<optimized out>) at qxcbeventdispatcher.cpp:105
#34 0x00007fc1ae524ef0 in ?? () from /lib64/libglib-2.0.so.0
#35 0x00007fc1ae526b18 in ?? () from /lib64/libglib-2.0.so.0
#36 0x00007fc1ae5271cc in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#37 0x00007fc1b1f464a6 in QEventDispatcherGlib::processEvents (this=0x1b33940, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#38 0x00007fc1b1eebffb in QEventLoop::exec (this=this@entry=0x7ffd33131570, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#39 0x00007fc1b2dada07 in QDialog::exec (this=0x21206f0) at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#40 0x00000000005ea950 in AnnotationDialog::Dialog::exec (this=0x21206f0) at /home/victor/kphotoalbum/AnnotationDialog/Dialog.cpp:959
#41 0x00000000005e8be8 in AnnotationDialog::Dialog::configure (this=0x21206f0, list=..., oneAtATime=true) at /home/victor/kphotoalbum/AnnotationDialog/Dialog.cpp:771
#42 0x00000000005376b7 in MainWindow::Window::configImages (this=0x1cbeca0, list=..., oneAtATime=true) at /home/victor/kphotoalbum/MainWindow/Window.cpp:509
#43 0x0000000000537655 in MainWindow::Window::configureImages (list=..., oneAtATime=true) at /home/victor/kphotoalbum/MainWindow/Window.cpp:503
#44 0x00000000004d9a15 in operator() (__closure=0x7fc19400a990) at /home/victor/kphotoalbum/Viewer/ViewerWidget.cpp:978
#45 0x00000000004e0c7f in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, Viewer::ViewerWidget::editImage()::<lambda()> >::call(struct {...} &, void **) (f=..., arg=0x254a268) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:146
#46 0x00000000004e0b6b in QtPrivate::Functor<Viewer::ViewerWidget::editImage()::<lambda()>, 0>::call<QtPrivate::List<>, void>(struct {...} &, void *, void **) (f=..., arg=0x254a268) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:256
#47 0x00000000004e0a80 in QtPrivate::QFunctorSlotObject<Viewer::ViewerWidget::editImage()::<lambda()>, 0, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *) (which=1, this_=0x7fc19400a980, r=0x1a56e00, a=0x254a268, ret=0x0) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:443
#48 0x00007fc1b1f19320 in QObject::event (this=0x1a56e00, e=0x254a220) at kernel/qobject.cpp:1347
#49 0x00007fc1b2ba519e in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x1a56e00, e=0x254a220) at kernel/qapplication.cpp:3640
#50 0x00007fc1b1eed568 in QCoreApplication::notifyInternal2 (receiver=0x1a56e00, event=0x254a220) at kernel/qcoreapplication.cpp:1064
#51 0x00007fc1b1eed72e in QCoreApplication::sendEvent (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1462
#52 0x00007fc1b1ef0b61 in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x1a56d80) at kernel/qcoreapplication.cpp:1821
#53 0x00007fc1b1ef10a8 in QCoreApplication::sendPostedEvents (receiver=<optimized out>, event_type=<optimized out>) at kernel/qcoreapplication.cpp:1680
#54 0x00007fc1b1f46c93 in postEventSourceDispatch (s=0x1b2e220) at kernel/qeventdispatcher_glib.cpp:277
#55 0x00007fc1ae524ef0 in ?? () from /lib64/libglib-2.0.so.0
#56 0x00007fc1ae526b18 in ?? () from /lib64/libglib-2.0.so.0
#57 0x00007fc1ae5271cc in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#58 0x00007fc1b1f464a6 in QEventDispatcherGlib::processEvents (this=0x1b33940, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#59 0x00007fc1b1eebffb in QEventLoop::exec (this=this@entry=0x7ffd33131be0, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#60 0x00007fc1b1ef4490 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#61 0x0000000000472a60 in main (argc=2, argv=0x7ffd331322e8) at /home/victor/kphotoalbum/main.cpp:161
[Inferior 1 (process 4697) detached]
Comment 1 Andreas Schleth 2023-11-05 18:39:04 UTC
same here:
openSuse Leap 15.5
KPA git master v5.11.0-166-g7c4b2886
KDE Frameworks 5.103.0
Qt 5.15.8
Plasma 5.27.4

Steps 3 and 4 can be in any order.
Comment 2 Johannes Zarl-Zierl 2023-11-05 22:08:59 UTC
Git commit 08a2bf1cbd23d48e199f924bf32be128c12bd98b by Johannes Zarl-Zierl.
Committed on 05/11/2023 at 22:57.
Pushed by johanneszarl into branch 'master'.

Don't emit Category::changed() when there's no change.

Emitting the changed() signal caused the
CategoryCollection::categoryCollectionChanged() signal when the Viewer
context menu "show" was activated, causing the AnnotationDialog being
closed if it was open at the time.

M  +17   -4    DB/Category.cpp

https://invent.kde.org/graphics/kphotoalbum/-/commit/08a2bf1cbd23d48e199f924bf32be128c12bd98b
Comment 3 Johannes Zarl-Zierl 2023-11-05 22:17:55 UTC
I'm not 100% sure that this does actually fix the bug in all instances, but it does inhibit the issue of the AnnotationDialog being closed when the Viewer->show context menu is activated.

You can e.g. still trigger the closing of the annotation dialog by changing the visibility of a category - but this does not cause a crash. And since the stack trace is mostly inside QtWidgets, I don't know what is causing the crash exactly.

I'm still debating whether changing the visibility of the Category in the viewer infobox actually needs to emit the signal that causes the annotation dialog to close. If I change this detail, I'll CC this bug...
Comment 4 Andreas Schleth 2023-11-06 13:00:52 UTC
With v5.11.0-171-g314e3ca7  I do not see the crash anymore :-)
Comment 5 Andreas Schleth 2023-11-06 23:11:16 UTC
... with this version (v5.11.0-171-g314e3ca7) I see a different crash that might be related. But I will post a different bug message: https://bugs.kde.org/show_bug.cgi?id=476651
Comment 6 Victor Lobo 2023-11-12 01:08:56 UTC
Fix works for me too. Thank you!