Bug 477531 - KPhotoAlbum git master crashes when a new Category is added, deleted and then added again in Settings
Summary: KPhotoAlbum git master crashes when a new Category is added, deleted and then...
Status: VERIFIED FIXED
Alias: None
Product: kphotoalbum
Classification: Applications
Component: general (show other bugs)
Version: GIT master
Platform: openSUSE Linux
: NOR crash
Target Milestone: ---
Assignee: KPhotoAlbum Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-25 23:54 UTC by Victor Lobo
Modified: 2023-12-03 22:53 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 Victor Lobo 2023-11-25 23:54:13 UTC
SUMMARY
KPhotoAlbum git master crashes when a new Category is added, deleted and then added again in Settings. Crash occurs only in the git version (not in 5.11.0)


Steps to Reproduce crash
1. Open KPhotoAlbum (kphotoalbum --demo)
2. From the main menu go to Settings > Configure KPhotoAlbum... > Categories
3. (Save the DB now if needed) and then click New button to create a new Category
4. Click OK to save settings
5. Go to Setting screen again and delete the category created (save the DB if needed)
6. Click OK to confirm deletion
7. Click OK to save settings
8. Go to Setting screen again and create a new (same or different) category  (save the DB if needed)
9. Click OK to save setting
10. 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 development version latest git master v5.12.0


ADDITIONAL INFORMATION
1. Crash is reproducible every time the steps are followed.
2. Crash occurs even in the demo database.


Another way to reproduce crash with similar backtrace
1. Go to setting then delete People Category, click ok twice to save settings, go back to settings and delete Places category, click ok twice, crash


Backtrace:
Application: KPhotoAlbum (kphotoalbum), signal: Aborted

[KCrash Handler]
#4  0x00007fd8a1a91dec in __pthread_kill_implementation () from /lib64/libc.so.6
#5  0x00007fd8a1a3f0c6 in raise () from /lib64/libc.so.6
#6  0x00007fd8a1a268d7 in abort () from /lib64/libc.so.6
#7  0x00007fd8a22bb51f in qt_message_fatal (message=<synthetic pointer>..., context=...) at global/qlogging.cpp:1919
#8  QMessageLogger::fatal (this=this@entry=0x7ffeca7fe8c8, msg=msg@entry=0x7fd8a25d2028 "ASSERT failure in %s: \"%s\", file %s, line %d") at global/qlogging.cpp:898
#9  0x00007fd8a22ba78c in qt_assert_x (where=<optimized out>, what=<optimized out>, file=<optimized out>, line=<optimized out>) at global/qglobal.cpp:3400
#10 0x00000000005724a3 in DB::CategoryCollection::removeCategory (this=0x1b8c248, name=...) at /home/victor/kphotoalbum/DB/CategoryCollection.cpp:73
#11 0x0000000000486d8e in Settings::CategoryItem::removeFromDatabase (this=0x22b0950) at /home/victor/kphotoalbum/Settings/CategoryItem.cpp:90
#12 0x000000000048b9ef in Settings::CategoryPage::saveSettings (this=0x2275810, opt=0x2072ff0, memberMap=0x26500b0) at /home/victor/kphotoalbum/Settings/CategoryPage.cpp:489
#13 0x0000000000483d16 in Settings::SettingsDialog::slotMyOK (this=0x205fe40) at /home/victor/kphotoalbum/Settings/SettingsDialog.cpp:121
#14 0x0000000000485e02 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (Settings::SettingsDialog::*)()>::call(void (Settings::SettingsDialog::*)(), Settings::SettingsDialog*, void**) (f=(void (Settings::SettingsDialog::*)(Settings::SettingsDialog * const)) 0x483c50 <Settings::SettingsDialog::slotMyOK()>, o=0x205fe40, arg=0x7ffeca7feb80) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:152
#15 0x0000000000485b4e in QtPrivate::FunctionPointer<void (Settings::SettingsDialog::*)()>::call<QtPrivate::List<>, void>(void (Settings::SettingsDialog::*)(), Settings::SettingsDialog*, void**) (f=(void (Settings::SettingsDialog::*)(Settings::SettingsDialog * const)) 0x483c50 <Settings::SettingsDialog::slotMyOK()>, o=0x205fe40, arg=0x7ffeca7feb80) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:185
#16 0x00000000004854dd in QtPrivate::QSlotObject<void (Settings::SettingsDialog::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x2bdb690, r=0x205fe40, a=0x7ffeca7feb80, ret=0x0) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:418
#17 0x00007fd8a2525442 in QtPrivate::QSlotObjectBase::call (a=0x7ffeca7feb80, r=0x205fe40, this=0x2bdb690) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#18 doActivate<false> (sender=0x205fe40, signal_index=8, argv=0x7ffeca7feb80) at kernel/qobject.cpp:3925
#19 0x00007fd8a251e0af in QMetaObject::activate (sender=sender@entry=0x205fe40, m=m@entry=0x7fd8a36d04c0 <QDialog::staticMetaObject>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x0) at kernel/qobject.cpp:3985
#20 0x00007fd8a33ac4e3 in QDialog::accepted (this=this@entry=0x205fe40) at .moc/moc_qdialog.cpp:236
#21 0x00007fd8a33ac968 in QDialogPrivate::finalize (this=<optimized out>, resultCode=1, dialogCode=<optimized out>) at dialogs/qdialog.cpp:176
#22 0x00007fd8a2525442 in QtPrivate::QSlotObjectBase::call (a=0x7ffeca7fec70, r=0x205fe40, this=0x253a940) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#23 doActivate<false> (sender=0x2524a50, signal_index=8, argv=0x7ffeca7fec70) at kernel/qobject.cpp:3925
#24 0x00007fd8a251e0af in QMetaObject::activate (sender=sender@entry=0x2524a50, m=m@entry=0x7fd8a36c9440 <QDialogButtonBox::staticMetaObject>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x0) at kernel/qobject.cpp:3985
#25 0x00007fd8a3340213 in QDialogButtonBox::accepted (this=this@entry=0x2524a50) at .moc/moc_qdialogbuttonbox.cpp:287
#26 0x00007fd8a3340870 in QDialogButtonBoxPrivate::_q_handleButtonClicked (this=<optimized out>) at widgets/qdialogbuttonbox.cpp:878
#27 0x00007fd8a25253e3 in doActivate<false> (sender=0x253a170, signal_index=9, argv=0x7ffeca7fedd0) at kernel/qobject.cpp:3937
#28 0x00007fd8a251e0af in QMetaObject::activate (sender=sender@entry=0x253a170, m=m@entry=0x7fd8a36c0280 <QAbstractButton::staticMetaObject>, local_signal_index=local_signal_index@entry=2, argv=argv@entry=0x7ffeca7fedd0) at kernel/qobject.cpp:3985
#29 0x00007fd8a3296ae2 in QAbstractButton::clicked (this=this@entry=0x253a170, _t1=<optimized out>) at .moc/moc_qabstractbutton.cpp:308
#30 0x00007fd8a3296d4a in QAbstractButtonPrivate::emitClicked (this=0x23d55d0) at widgets/qabstractbutton.cpp:416
#31 0x00007fd8a3298587 in QAbstractButtonPrivate::click (this=0x23d55d0) at widgets/qabstractbutton.cpp:409
#32 0x00007fd8a3298797 in QAbstractButton::mouseReleaseEvent (this=0x253a170, e=0x7ffeca7ff360) at widgets/qabstractbutton.cpp:1045
#33 0x00007fd8a31e6d58 in QWidget::event (this=0x253a170, event=0x7ffeca7ff360) at kernel/qwidget.cpp:9045
#34 0x00007fd8a31a519e in QApplicationPrivate::notify_helper (this=this@entry=0x1b66130, receiver=receiver@entry=0x253a170, e=e@entry=0x7ffeca7ff360) at kernel/qapplication.cpp:3640
#35 0x00007fd8a31ad5cf in QApplication::notify (this=<optimized out>, receiver=<optimized out>, e=0x7ffeca7ff360) at kernel/qapplication.cpp:3084
#36 0x00007fd8a24ed198 in QCoreApplication::notifyInternal2 (receiver=0x253a170, event=0x7ffeca7ff360) at kernel/qcoreapplication.cpp:1064
#37 0x00007fd8a24ed36e in QCoreApplication::sendSpontaneousEvent (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1474
#38 0x00007fd8a31ab92e in QApplicationPrivate::sendMouseEvent (receiver=receiver@entry=0x253a170, event=event@entry=0x7ffeca7ff360, alienWidget=<optimized out>, nativeWidget=0x205fe40, buttonDown=buttonDown@entry=0x7fd8a36f2330 <qt_button_down>, lastMouseReceiver=..., spontaneous=true, onlyDispatchEnterLeave=false) at kernel/qapplication.cpp:2622
#39 0x00007fd8a31ff7ed in QWidgetWindow::handleMouseEvent (this=this@entry=0x2a2eba0, event=event@entry=0x7ffeca7ff610) at kernel/qwidgetwindow.cpp:684
#40 0x00007fd8a3202d0f in QWidgetWindow::event (this=0x2a2eba0, event=0x7ffeca7ff610) at kernel/qwidgetwindow.cpp:300
#41 0x00007fd8a31a519e in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x2a2eba0, e=0x7ffeca7ff610) at kernel/qapplication.cpp:3640
#42 0x00007fd8a24ed198 in QCoreApplication::notifyInternal2 (receiver=0x2a2eba0, event=0x7ffeca7ff610) at kernel/qcoreapplication.cpp:1064
#43 0x00007fd8a24ed36e in QCoreApplication::sendSpontaneousEvent (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1474
#44 0x00007fd8a297d0db in QGuiApplicationPrivate::processMouseEvent (e=0x2bf7460) at kernel/qguiapplication.cpp:2285
#45 0x00007fd8a295038c in QWindowSystemInterface::sendWindowSystemEvents (flags=flags@entry=...) at kernel/qwindowsysteminterface.cpp:1169
#46 0x00007fd8934f854a in xcbSourceDispatch (source=<optimized out>) at qxcbeventdispatcher.cpp:105
#47 0x00007fd89f0b1f30 in ?? () from /lib64/libglib-2.0.so.0
#48 0x00007fd89f0b3b58 in ?? () from /lib64/libglib-2.0.so.0
#49 0x00007fd89f0b420c in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#50 0x00007fd8a25460d6 in QEventDispatcherGlib::processEvents (this=0x1c40dc0, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#51 0x00007fd8a24ebc2b in QEventLoop::exec (this=this@entry=0x7ffeca7ff940, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#52 0x00007fd8a24f40c0 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#53 0x0000000000472a68 in main (argc=2, argv=0x7ffeca800048) at /home/victor/kphotoalbum/main.cpp:161
[Inferior 1 (process 6057) detached]
Comment 1 Johannes Zarl-Zierl 2023-11-28 22:26:30 UTC
Git commit 460b2c505abaa51efac0f77811ec61f627ee6e31 by Johannes Zarl-Zierl.
Committed on 28/11/2023 at 23:17.
Pushed by johanneszarl into branch 'master'.

Fix crash when deleting a category and doing a second category action.

After deleting a category via the Settings::CategoryPage, the deleted
category would remain in the list of categories to delete.
If one then opened the category page again and chose "OK" or "Apply",
KPhotoAlbum would try to remove the already removed category again,
triggering an assertion.

M  +3    -0    DB/CategoryCollection.cpp
M  +3    -6    Settings/CategoryPage.cpp

https://invent.kde.org/graphics/kphotoalbum/-/commit/460b2c505abaa51efac0f77811ec61f627ee6e31
Comment 2 Victor Lobo 2023-12-03 22:53:43 UTC
This woks well now. Thank you!