SUMMARY KPhotoAlbum crashes on clicking "Copy Image to ..." or "Link Image to ..." in Full screen preview in Annotations window STEPS TO REPRODUCE 1. Open KPhotoAlbum 2. Go to Thumbnail View 3. Open an Image/Video in Annotations window 4. Click on Toggle full-screen preview (Ctrl-Space) 5. Right Click and then in context menu Click on "Copy Image to ..." F7 or "Link Image to ..." Shift+F7 6. 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-139-g3786a06e 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 0x00000000004736ae in QString::isEmpty (this=0x610072007b) at /usr/include/qt5/QtCore/qstring.h:1078 #5 0x00000000005608e7 in MainWindow::CopyLinkEngine::selectTarget (this=0x610072006b, parent=0x2b88d50, files=..., action=MainWindow::CopyLinkEngine::Copy) at /home/victor/kphotoalbum/MainWindow/CopyLinkEngine.cpp:30 #6 0x00000000004dea8b in Viewer::ViewerWidget::triggerCopyLinkAction (this=0x2b88d50, action=MainWindow::CopyLinkEngine::Copy) at /home/victor/kphotoalbum/Viewer/ViewerWidget.cpp:1572 #7 0x00000000004e74a4 in std::__invoke_impl<void, void (Viewer::ViewerWidget::*&)(MainWindow::CopyLinkEngine::Action), Viewer::ViewerWidget*&, MainWindow::CopyLinkEngine::Action&> (__f=@0x2f0a810: (void (Viewer::ViewerWidget::*)(Viewer::ViewerWidget * const, MainWindow::CopyLinkEngine::Action)) 0x4de996 <Viewer::ViewerWidget::triggerCopyLinkAction(MainWindow::CopyLinkEngine::Action)>, __t=@0x2f0a828: 0x2b88d50) at /usr/include/c++/13/bits/invoke.h:74 #8 0x00000000004e731d in std::__invoke<void (Viewer::ViewerWidget::*&)(MainWindow::CopyLinkEngine::Action), Viewer::ViewerWidget*&, MainWindow::CopyLinkEngine::Action&> (__fn=@0x2f0a810: (void (Viewer::ViewerWidget::*)(Viewer::ViewerWidget * const, MainWindow::CopyLinkEngine::Action)) 0x4de996 <Viewer::ViewerWidget::triggerCopyLinkAction(MainWindow::CopyLinkEngine::Action)>) at /usr/include/c++/13/bits/invoke.h:96 #9 0x00000000004e7199 in std::_Bind<void (Viewer::ViewerWidget::*(Viewer::ViewerWidget*, MainWindow::CopyLinkEngine::Action))(MainWindow::CopyLinkEngine::Action)>::__call<void, bool&, 0ul, 1ul>(std::tuple<bool&>&&, std::_Index_tuple<0ul, 1ul>) (this=0x2f0a810, __args=...) at /usr/include/c++/13/functional:506 #10 0x00000000004e7059 in std::_Bind<void (Viewer::ViewerWidget::*(Viewer::ViewerWidget*, MainWindow::CopyLinkEngine::Action))(MainWindow::CopyLinkEngine::Action)>::operator()<bool&, void>(bool&) (this=0x2f0a810) at /usr/include/c++/13/functional:591 #11 0x00000000004e6d50 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0>, QtPrivate::List<bool>, void, std::_Bind<void (Viewer::ViewerWidget::*(Viewer::ViewerWidget*, MainWindow::CopyLinkEngine::Action))(MainWindow::CopyLinkEngine::Action)> >::call(std::_Bind<void (Viewer::ViewerWidget::*(Viewer::ViewerWidget*, MainWindow::CopyLinkEngine::Action))(MainWindow::CopyLinkEngine::Action)>&, void**) (f=..., arg=0x7ffe208dbbd0) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:146 #12 0x00000000004e6ad2 in QtPrivate::Functor<std::_Bind<void (Viewer::ViewerWidget::*(Viewer::ViewerWidget*, MainWindow::CopyLinkEngine::Action))(MainWindow::CopyLinkEngine::Action)>, 1>::call<QtPrivate::List<bool>, void>(std::_Bind<void (Viewer::ViewerWidget::*(Viewer::ViewerWidget*, MainWindow::CopyLinkEngine::Action))(MainWindow::CopyLinkEngine::Action)>&, void*, void**) (f=..., arg=0x7ffe208dbbd0) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:256 #13 0x00000000004e626e in QtPrivate::QFunctorSlotObject<std::_Bind<void (Viewer::ViewerWidget::*(Viewer::ViewerWidget*, MainWindow::CopyLinkEngine::Action))(MainWindow::CopyLinkEngine::Action)>, 1, QtPrivate::List<bool>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x2f0a800, r=0x2b88d50, a=0x7ffe208dbbd0, ret=0x0) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:443 #14 0x00007f24f8f25812 in QtPrivate::QSlotObjectBase::call (a=0x7ffe208dbbd0, r=0x2b88d50, this=0x2f0a800) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398 #15 doActivate<false> (sender=0x2f0a900, signal_index=4, argv=0x7ffe208dbbd0) at kernel/qobject.cpp:3925 #16 0x00007f24f8f1e47f in QMetaObject::activate (sender=sender@entry=0x2f0a900, m=m@entry=0x7f24fa0bacc0 <QAction::staticMetaObject>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x7ffe208dbbd0) at kernel/qobject.cpp:3985 #17 0x00007f24f9b9e8b2 in QAction::triggered (this=this@entry=0x2f0a900, _t1=<optimized out>) at .moc/moc_qaction.cpp:376 #18 0x00007f24f9ba142f in QAction::activate (this=0x2f0a900, event=<optimized out>) at kernel/qaction.cpp:1161 #19 0x00007f24f9ba200d in QAction::event (e=<optimized out>, this=<optimized out>) at kernel/qaction.cpp:1086 #20 QAction::event (this=<optimized out>, e=<optimized out>) at kernel/qaction.cpp:1075 #21 0x00007f24f9ba519e in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x2f0a900, e=0x7ffe208dbd70) at kernel/qapplication.cpp:3640 #22 0x00007f24f8eed568 in QCoreApplication::notifyInternal2 (receiver=0x2f0a900, event=0x7ffe208dbd70) at kernel/qcoreapplication.cpp:1064 #23 0x00007f24f8eed72e in QCoreApplication::sendEvent (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1462 #24 0x00007f24f93ad671 in QShortcutMap::dispatchEvent (this=<optimized out>, e=<optimized out>) at kernel/qshortcutmap.cpp:675 #25 0x00007f24f93ae28b in QShortcutMap::tryShortcut (this=this@entry=0x23dc288, e=e@entry=0x7ffe208dbe30) at kernel/qshortcutmap.cpp:343 #26 0x00007f24f9353976 in QWindowSystemInterface::handleShortcutEvent (window=<optimized out>, timestamp=936747, keyCode=16777270, modifiers=..., nativeScanCode=73, nativeVirtualKey=65476, nativeModifiers=16, text=..., autorepeat=false, count=1) at kernel/qwindowsysteminterface.cpp:477 #27 0x00007f24f9378d9d in QGuiApplicationPrivate::processKeyEvent (e=0x4265730) at kernel/qguiapplication.cpp:2398 #28 0x00007f24f935036c in QWindowSystemInterface::sendWindowSystemEvents (flags=flags@entry=...) at kernel/qwindowsysteminterface.cpp:1169 #29 0x00007f24ed51b1aa in xcbSourceDispatch (source=<optimized out>) at qxcbeventdispatcher.cpp:105 #30 0x00007f24f5b169d8 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0 #31 0x00007f24f5b16de8 in ?? () from /lib64/libglib-2.0.so.0 #32 0x00007f24f5b16e7c in g_main_context_iteration () from /lib64/libglib-2.0.so.0 #33 0x00007f24f8f464a6 in QEventDispatcherGlib::processEvents (this=0x24b6e60, flags=...) at kernel/qeventdispatcher_glib.cpp:423 #34 0x00007f24f8eebffb in QEventLoop::exec (this=this@entry=0x7ffe208dc170, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69 #35 0x00007f24f9dada07 in QDialog::exec (this=0x2b62440) at ../../include/QtCore/../../src/corelib/global/qflags.h:121 #36 0x00000000005ea066 in AnnotationDialog::Dialog::exec (this=0x2b62440) at /home/victor/kphotoalbum/AnnotationDialog/Dialog.cpp:962 #37 0x00000000005e8328 in AnnotationDialog::Dialog::configure (this=0x2b62440, list=..., oneAtATime=true) at /home/victor/kphotoalbum/AnnotationDialog/Dialog.cpp:774 #38 0x0000000000536c57 in MainWindow::Window::configImages (this=0x26212e0, list=..., oneAtATime=true) at /home/victor/kphotoalbum/MainWindow/Window.cpp:509 #39 0x0000000000536bf5 in MainWindow::Window::configureImages (list=..., oneAtATime=true) at /home/victor/kphotoalbum/MainWindow/Window.cpp:503 #40 0x0000000000536b4c in MainWindow::Window::configureImages (this=0x26212e0, oneAtATime=true) at /home/victor/kphotoalbum/MainWindow/Window.cpp:497 #41 0x00000000005369db in MainWindow::Window::slotConfigureImagesOneAtATime (this=0x26212e0) at /home/victor/kphotoalbum/MainWindow/Window.cpp:483 #42 0x000000000054e828 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (MainWindow::Window::*)()>::call(void (MainWindow::Window::*)(), MainWindow::Window*, void**) (f=(void (MainWindow::Window::*)(MainWindow::Window * const)) 0x5369be <MainWindow::Window::slotConfigureImagesOneAtATime()>, o=0x26212e0, arg=0x7ffe208dc590) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:152 #43 0x000000000054de6d in QtPrivate::FunctionPointer<void (MainWindow::Window::*)()>::call<QtPrivate::List<>, void>(void (MainWindow::Window::*)(), MainWindow::Window*, void**) (f=(void (MainWindow::Window::*)(MainWindow::Window * const)) 0x5369be <MainWindow::Window::slotConfigureImagesOneAtATime()>, o=0x26212e0, arg=0x7ffe208dc590) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:185 #44 0x000000000054c5e9 in QtPrivate::QSlotObject<void (MainWindow::Window::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x2a54f20, r=0x26212e0, a=0x7ffe208dc590, ret=0x0) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:418 #45 0x00007f24f8f25812 in QtPrivate::QSlotObjectBase::call (a=0x7ffe208dc590, r=0x26212e0, this=0x2a54f20) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398 #46 doActivate<false> (sender=0x2a55050, signal_index=4, argv=0x7ffe208dc590) at kernel/qobject.cpp:3925 #47 0x00007f24f8f1e47f in QMetaObject::activate (sender=sender@entry=0x2a55050, m=m@entry=0x7f24fa0bacc0 <QAction::staticMetaObject>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x7ffe208dc590) at kernel/qobject.cpp:3985 #48 0x00007f24f9b9e8b2 in QAction::triggered (this=this@entry=0x2a55050, _t1=<optimized out>) at .moc/moc_qaction.cpp:376 #49 0x00007f24f9ba142f in QAction::activate (this=0x2a55050, event=<optimized out>) at kernel/qaction.cpp:1161 #50 0x00007f24f9d25ef2 in QMenuPrivate::activateCausedStack (this=this@entry=0x2b57cc0, causedStack=..., action=action@entry=0x2a55050, action_e=action_e@entry=QAction::Trigger, self=self@entry=true) at widgets/qmenu.cpp:1384 #51 0x00007f24f9d2dd23 in QMenuPrivate::activateAction (this=0x2b57cc0, action=0x2a55050, action_e=QAction::Trigger, self=true) at widgets/qmenu.cpp:1461 #52 0x00007f24f9be6d68 in QWidget::event (this=0x7ffe208dd250, event=0x7ffe208dcb80) at kernel/qwidget.cpp:9045 #53 0x00007f24f9ba519e in QApplicationPrivate::notify_helper (this=this@entry=0x23dc1c0, receiver=receiver@entry=0x7ffe208dd250, e=e@entry=0x7ffe208dcb80) at kernel/qapplication.cpp:3640 #54 0x00007f24f9bad5cf in QApplication::notify (this=<optimized out>, receiver=<optimized out>, e=0x7ffe208dcb80) at kernel/qapplication.cpp:3084 #55 0x00007f24f8eed568 in QCoreApplication::notifyInternal2 (receiver=0x7ffe208dd250, event=0x7ffe208dcb80) at kernel/qcoreapplication.cpp:1064 #56 0x00007f24f8eed73e in QCoreApplication::sendSpontaneousEvent (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1474 #57 0x00007f24f9bab92e in QApplicationPrivate::sendMouseEvent (receiver=0x7ffe208dd250, event=event@entry=0x7ffe208dcb80, alienWidget=<optimized out>, nativeWidget=0x7ffe208dd250, buttonDown=buttonDown@entry=0x7f24fa0f2330 <qt_button_down>, lastMouseReceiver=..., spontaneous=true, onlyDispatchEnterLeave=false) at kernel/qapplication.cpp:2622 #58 0x00007f24f9c002ca in QWidgetWindow::handleMouseEvent (this=this@entry=0x2b61950, event=event@entry=0x7ffe208dce30) at kernel/qwidgetwindow.cpp:580 #59 0x00007f24f9c02d1f in QWidgetWindow::event (this=0x2b61950, event=0x7ffe208dce30) at kernel/qwidgetwindow.cpp:300 #60 0x00007f24f9ba519e in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x2b61950, e=0x7ffe208dce30) at kernel/qapplication.cpp:3640 #61 0x00007f24f8eed568 in QCoreApplication::notifyInternal2 (receiver=0x2b61950, event=0x7ffe208dce30) at kernel/qcoreapplication.cpp:1064 #62 0x00007f24f8eed73e in QCoreApplication::sendSpontaneousEvent (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1474 #63 0x00007f24f937d0eb in QGuiApplicationPrivate::processMouseEvent (e=0x2bab530) at kernel/qguiapplication.cpp:2285 #64 0x00007f24f935036c in QWindowSystemInterface::sendWindowSystemEvents (flags=flags@entry=...) at kernel/qwindowsysteminterface.cpp:1169 #65 0x00007f24ed51b1aa in xcbSourceDispatch (source=<optimized out>) at qxcbeventdispatcher.cpp:105 #66 0x00007f24f5b169d8 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0 #67 0x00007f24f5b16de8 in ?? () from /lib64/libglib-2.0.so.0 #68 0x00007f24f5b16e7c in g_main_context_iteration () from /lib64/libglib-2.0.so.0 #69 0x00007f24f8f464a6 in QEventDispatcherGlib::processEvents (this=0x24b6e60, flags=...) at kernel/qeventdispatcher_glib.cpp:423 #70 0x00007f24f8eebffb in QEventLoop::exec (this=this@entry=0x7ffe208dd170, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69 #71 0x00007f24f9d2b70f in QMenuPrivate::exec(QPoint const&, QAction*, std::function<QPoint (QSize const&)>) (this=0x2b57cc0, p=..., action=0x0, positionFunction=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:121 #72 0x00007f24f9d2b82f in QMenu::exec (this=<optimized out>, p=..., action=<optimized out>) at widgets/qmenu.cpp:2686 #73 0x0000000000541abe in MainWindow::Window::contextMenuEvent (this=0x26212e0, e=0x7ffe208dd5a0) at /home/victor/kphotoalbum/MainWindow/Window.cpp:1318 #74 0x00007f24f9be6d68 in QWidget::event (this=0x26212e0, event=0x7ffe208dd5a0) at kernel/qwidget.cpp:9045 #75 0x00007f25044db469 in KXmlGuiWindow::event(QEvent*) () from /lib64/libKF5XmlGui.so.5 #76 0x0000000000538843 in MainWindow::Window::event (this=0x26212e0, event=0x7ffe208dd5a0) at /home/victor/kphotoalbum/MainWindow/Window.cpp:751 #77 0x00007f24f9ba519e in QApplicationPrivate::notify_helper (this=this@entry=0x23dc1c0, receiver=receiver@entry=0x26212e0, e=e@entry=0x7ffe208dd5a0) at kernel/qapplication.cpp:3640 #78 0x00007f24f9badaaa in QApplication::notify (this=<optimized out>, receiver=<optimized out>, e=0x7ffe208dd7d0) at kernel/qapplication.cpp:3246 #79 0x00007f24f8eed568 in QCoreApplication::notifyInternal2 (receiver=0x2a265a0, event=0x7ffe208dd7d0) at kernel/qcoreapplication.cpp:1064 #80 0x00007f24f8eed5b2 in QCoreApplication::forwardEvent (receiver=<optimized out>, event=<optimized out>, originatingEvent=<optimized out>) at kernel/qcoreapplication.cpp:1079 #81 0x00007f24f9bfff59 in QWidgetWindow::handleMouseEvent (this=this@entry=0x28d4480, event=event@entry=0x7ffe208ddac0) at kernel/qwidgetwindow.cpp:692 #82 0x00007f24f9c02d1f in QWidgetWindow::event (this=0x28d4480, event=0x7ffe208ddac0) at kernel/qwidgetwindow.cpp:300 #83 0x00007f24f9ba519e in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x28d4480, e=0x7ffe208ddac0) at kernel/qapplication.cpp:3640 #84 0x00007f24f8eed568 in QCoreApplication::notifyInternal2 (receiver=0x28d4480, event=0x7ffe208ddac0) at kernel/qcoreapplication.cpp:1064 #85 0x00007f24f8eed73e in QCoreApplication::sendSpontaneousEvent (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1474 #86 0x00007f24f937d0eb in QGuiApplicationPrivate::processMouseEvent (e=0x2b26df0) at kernel/qguiapplication.cpp:2285 #87 0x00007f24f935036c in QWindowSystemInterface::sendWindowSystemEvents (flags=flags@entry=...) at kernel/qwindowsysteminterface.cpp:1169 #88 0x00007f24ed51b1aa in xcbSourceDispatch (source=<optimized out>) at qxcbeventdispatcher.cpp:105 #89 0x00007f24f5b169d8 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0 #90 0x00007f24f5b16de8 in ?? () from /lib64/libglib-2.0.so.0 #91 0x00007f24f5b16e7c in g_main_context_iteration () from /lib64/libglib-2.0.so.0 #92 0x00007f24f8f464a6 in QEventDispatcherGlib::processEvents (this=0x24b6e60, flags=...) at kernel/qeventdispatcher_glib.cpp:423 #93 0x00007f24f8eebffb in QEventLoop::exec (this=this@entry=0x7ffe208dddf0, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69 #94 0x00007f24f8ef4490 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:121 #95 0x0000000000472a30 in main (argc=2, argv=0x7ffe208de4f8) at /home/victor/kphotoalbum/main.cpp:161 [Inferior 1 (process 3866) detached]
Git commit 2516c6e6ba68fba2ba92d758124c726447bb6126 by Tobias Leupold. Committed on 14/10/2023 at 11:24. Pushed by tleupold into branch 'master'. Pass a deep copy of the file list to CopyLinkEngine M +3 -2 MainWindow/CopyLinkEngine.cpp M +3 -2 MainWindow/CopyLinkEngine.h https://invent.kde.org/graphics/kphotoalbum/-/commit/2516c6e6ba68fba2ba92d758124c726447bb6126
To be honest, I have no idea why this happens. Passing a deep copy of the file list instead of a reference to the CopyLinkEngine does fix it though. Maybe Johannes can explain why this happens?! After all, it's the very same as if it's triggered from the viewer directly, no?!
Git commit 205a0f02baa2109e37ccb86781c2d6fb3a9d1dfd by Tobias Leupold. Committed on 14/10/2023 at 11:32. Pushed by tleupold into branch 'master'. Sadly not fixed. Use a const reference M +1 -1 MainWindow/CopyLinkEngine.cpp M +1 -2 MainWindow/CopyLinkEngine.h M +1 -1 Viewer/ViewerWidget.cpp https://invent.kde.org/graphics/kphotoalbum/-/commit/205a0f02baa2109e37ccb86781c2d6fb3a9d1dfd
No, that didn't really fix it. One time, it works, one time, it crashes. Very strange. I now changed the CopyLinkEngine to use a const reference (as it should be), but I think, the problem is rather somewhere in the show quasi-fullscreen of the viewer, not in the CopyLinkEngine. I must admit that I'm a bit puzzled atm … :-(
Git commit c6c7df0d8cdb79a9e2ea49f88c1d181beabb6bae by Johannes Zarl-Zierl. Committed on 14/10/2023 at 23:33. Pushed by johanneszarl into branch 'master'. Restrict set of context menu actions available in annotation dialog's fullscreen preview This also removes the copy/link actions that caused the crash in bug #475585, which should never have been available at this place in the program. M +1 -1 AnnotationDialog/Dialog.cpp M +3 -0 CHANGELOG.md M +5 -4 MainWindow/Window.cpp M +84 -45 Viewer/ViewerWidget.cpp M +6 -3 Viewer/ViewerWidget.h https://invent.kde.org/graphics/kphotoalbum/-/commit/c6c7df0d8cdb79a9e2ea49f88c1d181beabb6bae
That fixes the crash. Thanks!