Bug 477529

Summary: KPhotoAlbum crashes when Category for Untagged Images is set to "None Selected" in Settings
Product: [Applications] kphotoalbum Reporter: Victor Lobo <victor.ip.lobo>
Component: generalAssignee: KPhotoAlbum Bugs <kpabugs>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: GIT master   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Victor Lobo 2023-11-25 23:47:31 UTC
SUMMARY
KPhotoAlbum crashes when Category for Untagged Images is set to "None Selected" in Settings


STEPS TO REPRODUCE
1. Open KPhotoAlbum (kphotoalbum --demo)
2. From the main menu go to Settings > Configure KPhotoAlbum... > Categories
3. Set Untagged Images Category to "None Selected"
4. Click OK to save settings
5. 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 v5.11 and
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.

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

[KCrash Handler]
#4  0x00007fdcc0d9a69d in QListData::begin (this=0x40) at ../../include/QtCore/../../src/corelib/tools/qlist.h:118
#5  QList<QString>::begin (this=0x40) at ../../include/QtCore/../../src/corelib/tools/qlist.h:339
#6  stringList_contains<QString> (cs=Qt::CaseSensitive, str=..., stringList=...) at text/qstringlist.cpp:341
#7  QtPrivate::QStringList_contains (that=0x40, str=..., cs=Qt::CaseSensitive) at text/qstringlist.cpp:366
#8  0x0000000000493763 in QStringList::contains (this=0x40, str=..., cs=Qt::CaseSensitive) at /usr/include/qt5/QtCore/qstringlist.h:263
#9  0x000000000057583f in DB::Category::itemForName (this=0x0, tag=...) at /home/victor/kphotoalbum/DB/Category.cpp:266
#10 0x000000000058bef9 in DB::ImageDB::setUntaggedTag (this=0x111d050, category=..., tag=...) at /home/victor/kphotoalbum/DB/ImageDB.cpp:984
#11 0x0000000000590c91 in QtPrivate::FunctorCall<QtPrivate::IndexesList<0, 1>, QtPrivate::List<QString const&, QString const&>, void, void (DB::ImageDB::*)(QString const&, QString const&)>::call (f=(void (DB::ImageDB::*)(DB::ImageDB * const, const QString &, const QString &)) 0x58bea4 <DB::ImageDB::setUntaggedTag(QString const&, QString const&)>, o=0x111d050, arg=0x7ffc5d63e540) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:152
#12 0x00000000005908d6 in QtPrivate::FunctionPointer<void (DB::ImageDB::*)(QString const&, QString const&)>::call<QtPrivate::List<QString const&, QString const&>, void> (f=(void (DB::ImageDB::*)(DB::ImageDB * const, const QString &, const QString &)) 0x58bea4 <DB::ImageDB::setUntaggedTag(QString const&, QString const&)>, o=0x111d050, arg=0x7ffc5d63e540) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:185
#13 0x0000000000590415 in QtPrivate::QSlotObject<void (DB::ImageDB::*)(QString const&, QString const&), QtPrivate::List<QString const&, QString const&>, void>::impl (which=1, this_=0x1743990, r=0x111d050, a=0x7ffc5d63e540, ret=0x0) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:418
#14 0x00007fdcc0f25442 in QtPrivate::QSlotObjectBase::call (a=0x7ffc5d63e540, r=0x111d050, this=0x1743990) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#15 doActivate<false> (sender=0x7fdca4003680, signal_index=13, argv=0x7ffc5d63e540) at kernel/qobject.cpp:3925
#16 0x00007fdccbb5f850 in Settings::SettingsData::untaggedTagChanged (this=0x7fdca4003680, _t1=..., _t2=...) at /home/victor/kphotoalbum/build/lib/kpabase_autogen/include/moc_SettingsData.cpp:323
#17 0x00007fdccbb59f14 in Settings::SettingsData::setUntaggedCategory (this=0x7fdca4003680, value=...) at /home/victor/kphotoalbum/lib/kpabase/SettingsData.cpp:418
#18 0x00000000004a2e13 in Settings::UntaggedGroupBox::saveSettings (this=0x1a34d00, opt=0x7fdca4003680) at /home/victor/kphotoalbum/Settings/UntaggedGroupBox.cpp:126
#19 0x000000000048bab2 in Settings::CategoryPage::saveSettings (this=0x17020d0, opt=0x7fdca4003680, memberMap=0x1a6d3b0) at /home/victor/kphotoalbum/Settings/CategoryPage.cpp:500
#20 0x0000000000483d16 in Settings::SettingsDialog::slotMyOK (this=0x16ce580) at /home/victor/kphotoalbum/Settings/SettingsDialog.cpp:121
#21 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=0x16ce580, arg=0x7ffc5d63e880) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:152
#22 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=0x16ce580, arg=0x7ffc5d63e880) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:185
#23 0x00000000004854dd in QtPrivate::QSlotObject<void (Settings::SettingsDialog::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x1ff7f30, r=0x16ce580, a=0x7ffc5d63e880, ret=0x0) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:418
#24 0x00007fdcc0f25442 in QtPrivate::QSlotObjectBase::call (a=0x7ffc5d63e880, r=0x16ce580, this=0x1ff7f30) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#25 doActivate<false> (sender=0x16ce580, signal_index=8, argv=0x7ffc5d63e880) at kernel/qobject.cpp:3925
#26 0x00007fdcc0f1e0af in QMetaObject::activate (sender=sender@entry=0x16ce580, m=m@entry=0x7fdcc20d04c0 <QDialog::staticMetaObject>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x0) at kernel/qobject.cpp:3985
#27 0x00007fdcc1dac4e3 in QDialog::accepted (this=this@entry=0x16ce580) at .moc/moc_qdialog.cpp:236
#28 0x00007fdcc1dac968 in QDialogPrivate::finalize (this=<optimized out>, resultCode=1, dialogCode=<optimized out>) at dialogs/qdialog.cpp:176
#29 0x00007fdcc0f25442 in QtPrivate::QSlotObjectBase::call (a=0x7ffc5d63e970, r=0x16ce580, this=0x1887d20) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#30 doActivate<false> (sender=0x19398f0, signal_index=8, argv=0x7ffc5d63e970) at kernel/qobject.cpp:3925
#31 0x00007fdcc0f1e0af in QMetaObject::activate (sender=sender@entry=0x19398f0, m=m@entry=0x7fdcc20c9440 <QDialogButtonBox::staticMetaObject>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x0) at kernel/qobject.cpp:3985
#32 0x00007fdcc1d40213 in QDialogButtonBox::accepted (this=this@entry=0x19398f0) at .moc/moc_qdialogbuttonbox.cpp:287
#33 0x00007fdcc1d40870 in QDialogButtonBoxPrivate::_q_handleButtonClicked (this=<optimized out>) at widgets/qdialogbuttonbox.cpp:878
#34 0x00007fdcc0f253e3 in doActivate<false> (sender=0x1887500, signal_index=9, argv=0x7ffc5d63ead0) at kernel/qobject.cpp:3937
#35 0x00007fdcc0f1e0af in QMetaObject::activate (sender=sender@entry=0x1887500, m=m@entry=0x7fdcc20c0280 <QAbstractButton::staticMetaObject>, local_signal_index=local_signal_index@entry=2, argv=argv@entry=0x7ffc5d63ead0) at kernel/qobject.cpp:3985
#36 0x00007fdcc1c96ae2 in QAbstractButton::clicked (this=this@entry=0x1887500, _t1=<optimized out>) at .moc/moc_qabstractbutton.cpp:308
#37 0x00007fdcc1c96d4a in QAbstractButtonPrivate::emitClicked (this=0x195c1c0) at widgets/qabstractbutton.cpp:416
#38 0x00007fdcc1c98587 in QAbstractButtonPrivate::click (this=0x195c1c0) at widgets/qabstractbutton.cpp:409
#39 0x00007fdcc1c98797 in QAbstractButton::mouseReleaseEvent (this=0x1887500, e=0x7ffc5d63f060) at widgets/qabstractbutton.cpp:1045
#40 0x00007fdcc1be6d58 in QWidget::event (this=0x1887500, event=0x7ffc5d63f060) at kernel/qwidget.cpp:9045
#41 0x00007fdcc1ba519e in QApplicationPrivate::notify_helper (this=this@entry=0xf83130, receiver=receiver@entry=0x1887500, e=e@entry=0x7ffc5d63f060) at kernel/qapplication.cpp:3640
#42 0x00007fdcc1bad5cf in QApplication::notify (this=<optimized out>, receiver=<optimized out>, e=0x7ffc5d63f060) at kernel/qapplication.cpp:3084
#43 0x00007fdcc0eed198 in QCoreApplication::notifyInternal2 (receiver=0x1887500, event=0x7ffc5d63f060) at kernel/qcoreapplication.cpp:1064
#44 0x00007fdcc0eed36e in QCoreApplication::sendSpontaneousEvent (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1474
#45 0x00007fdcc1bab92e in QApplicationPrivate::sendMouseEvent (receiver=receiver@entry=0x1887500, event=event@entry=0x7ffc5d63f060, alienWidget=<optimized out>, nativeWidget=0x16ce580, buttonDown=buttonDown@entry=0x7fdcc20f2330 <qt_button_down>, lastMouseReceiver=..., spontaneous=true, onlyDispatchEnterLeave=false) at kernel/qapplication.cpp:2622
#46 0x00007fdcc1bff7ed in QWidgetWindow::handleMouseEvent (this=this@entry=0x1e4b5c0, event=event@entry=0x7ffc5d63f310) at kernel/qwidgetwindow.cpp:684
#47 0x00007fdcc1c02d0f in QWidgetWindow::event (this=0x1e4b5c0, event=0x7ffc5d63f310) at kernel/qwidgetwindow.cpp:300
#48 0x00007fdcc1ba519e in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x1e4b5c0, e=0x7ffc5d63f310) at kernel/qapplication.cpp:3640
#49 0x00007fdcc0eed198 in QCoreApplication::notifyInternal2 (receiver=0x1e4b5c0, event=0x7ffc5d63f310) at kernel/qcoreapplication.cpp:1064
#50 0x00007fdcc0eed36e in QCoreApplication::sendSpontaneousEvent (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1474
#51 0x00007fdcc137d0db in QGuiApplicationPrivate::processMouseEvent (e=0x1a07910) at kernel/qguiapplication.cpp:2285
#52 0x00007fdcc135038c in QWindowSystemInterface::sendWindowSystemEvents (flags=flags@entry=...) at kernel/qwindowsysteminterface.cpp:1169
#53 0x00007fdcb22f854a in xcbSourceDispatch (source=<optimized out>) at qxcbeventdispatcher.cpp:105
#54 0x00007fdcbdb13f30 in ?? () from /lib64/libglib-2.0.so.0
#55 0x00007fdcbdb15b58 in ?? () from /lib64/libglib-2.0.so.0
#56 0x00007fdcbdb1620c in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#57 0x00007fdcc0f460d6 in QEventDispatcherGlib::processEvents (this=0x105dd80, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#58 0x00007fdcc0eebc2b in QEventLoop::exec (this=this@entry=0x7ffc5d63f640, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#59 0x00007fdcc0ef40c0 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#60 0x0000000000472a68 in main (argc=2, argv=0x7ffc5d63fd48) at /home/victor/kphotoalbum/main.cpp:161
[Inferior 1 (process 4801) detached]
Comment 1 Johannes Zarl-Zierl 2023-11-26 23:32:16 UTC
Git commit f47882f098db868b4acfa0a2799d97faf882489b by Johannes Zarl-Zierl.
Committed on 27/11/2023 at 00:30.
Pushed by johanneszarl into branch 'master'.

Fix crash when clearing the untagged tag via settings

M  +1    -0    CHANGELOG.md
M  +5    -1    DB/ImageDB.cpp
M  +5    -0    DB/ImageDB.h

https://invent.kde.org/graphics/kphotoalbum/-/commit/f47882f098db868b4acfa0a2799d97faf882489b