Bug 477530 - KPhotoAlbum crashes when new Category is added and immediately set as Category for Untagged Images in Settings
Summary: KPhotoAlbum crashes when new Category is added and immediately set as Categor...
Status: RESOLVED 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:50 UTC by Victor Lobo
Modified: 2023-11-27 23:46 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-11-25 23:50:36 UTC
SUMMARY
KPhotoAlbum crashes when new Category is added and immediately set as Category for Untagged Images in Settings


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 click the New button to create a new category
4. Give the new category a different name then the default "New Category" (for example "test")
5. (Do NOT click OK yet in Setting) Pick the same newly created "test" category as Category for Untagged Images
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 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.
3. Crash with same backtrace is not seen when using default "New Category" name in Step 4

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

[KCrash Handler]
#4  0x0000000000493c31 in QList<QString>::QList (this=0x7ffcbc8a7610, l=...) at /usr/include/qt5/QtCore/qlist.h:854
#5  0x00000000004936d5 in QStringList::QStringList (this=0x7ffcbc8a7610) at /usr/include/qt5/QtCore/qstringlist.h:111
#6  0x0000000000574d8f in DB::Category::items (this=0x0) at /home/victor/kphotoalbum/DB/Category.cpp:149
#7  0x00000000004a2926 in Settings::UntaggedGroupBox::populateTagsCombo (this=0x1d051e0) at /home/victor/kphotoalbum/Settings/UntaggedGroupBox.cpp:70
#8  0x00000000004a3971 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (Settings::UntaggedGroupBox::*)()>::call(void (Settings::UntaggedGroupBox::*)(), Settings::UntaggedGroupBox*, void**) (f=(void (Settings::UntaggedGroupBox::*)(Settings::UntaggedGroupBox * const)) 0x4a283c <Settings::UntaggedGroupBox::populateTagsCombo()>, o=0x1d051e0, arg=0x7ffcbc8a7800) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:152
#9  0x00000000004a383d in QtPrivate::FunctionPointer<void (Settings::UntaggedGroupBox::*)()>::call<QtPrivate::List<>, void>(void (Settings::UntaggedGroupBox::*)(), Settings::UntaggedGroupBox*, void**) (f=(void (Settings::UntaggedGroupBox::*)(Settings::UntaggedGroupBox * const)) 0x4a283c <Settings::UntaggedGroupBox::populateTagsCombo()>, o=0x1d051e0, arg=0x7ffcbc8a7800) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:185
#10 0x00000000004a377f in QtPrivate::QSlotObject<void (Settings::UntaggedGroupBox::*)(), QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*) (which=1, this_=0x1d139e0, r=0x1d051e0, a=0x7ffcbc8a7800, ret=0x0) at /usr/include/qt5/QtCore/qobjectdefs_impl.h:418
#11 0x00007f53ed725442 in QtPrivate::QSlotObjectBase::call (a=0x7ffcbc8a7800, r=0x1d051e0, this=0x1d139e0) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#12 doActivate<false> (sender=0x1d0b250, signal_index=12, argv=0x7ffcbc8a7800) at kernel/qobject.cpp:3925
#13 0x00007f53ed71e0af in QMetaObject::activate (sender=sender@entry=0x1d0b250, m=m@entry=0x7f53ee8c26e0 <QComboBox::staticMetaObject>, local_signal_index=local_signal_index@entry=5, argv=argv@entry=0x7ffcbc8a7800) at kernel/qobject.cpp:3985
#14 0x00007f53ee4a8d11 in QComboBox::currentIndexChanged (this=this@entry=0x1d0b250, _t1=<optimized out>) at .moc/moc_qcombobox.cpp:538
#15 0x00007f53ee4aa4d2 in QComboBoxPrivate::_q_emitCurrentIndexChanged (this=this@entry=0x1d0b290, index=...) at ../../include/QtCore/../../src/corelib/itemmodels/qabstractitemmodel.h:62
#16 0x00007f53ee4add5b in QComboBoxPrivate::setCurrentIndex (this=this@entry=0x1d0b290, mi=...) at widgets/qcombobox.cpp:2331
#17 0x00007f53ee4adfc7 in QComboBoxPrivate::_q_itemSelected (this=0x1d0b290, item=...) at widgets/qcombobox.cpp:1432
#18 0x00007f53ed7253e3 in doActivate<false> (sender=0x1d0ca20, signal_index=7, argv=0x7ffcbc8a7a50) at kernel/qobject.cpp:3937
#19 0x00007f53ed71e0af in QMetaObject::activate (sender=sender@entry=0x1d0ca20, m=m@entry=0x7f53ee8c2620 <QComboBoxPrivateContainer::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7ffcbc8a7a50) at kernel/qobject.cpp:3985
#20 0x00007f53ee4a8f02 in QComboBoxPrivateContainer::itemSelected (this=this@entry=0x1d0ca20, _t1=...) at .moc/moc_qcombobox_p.cpp:348
#21 0x00007f53ee4a97c6 in QComboBoxPrivateContainer::eventFilter (this=0x1d0ca20, o=0x1d0d5c0, e=0x7ffcbc8a7fa0) at widgets/qcombobox.cpp:824
#22 0x00007f53ed6ecf1b in QCoreApplicationPrivate::sendThroughObjectEventFilters (receiver=receiver@entry=0x1d0d5c0, event=event@entry=0x7ffcbc8a7fa0) at kernel/qcoreapplication.cpp:1190
#23 0x00007f53ee3a518e in QApplicationPrivate::notify_helper (this=this@entry=0x124a130, receiver=receiver@entry=0x1d0d5c0, e=e@entry=0x7ffcbc8a7fa0) at kernel/qapplication.cpp:3634
#24 0x00007f53ee3ad5cf in QApplication::notify (this=<optimized out>, receiver=<optimized out>, e=0x7ffcbc8a7fa0) at kernel/qapplication.cpp:3084
#25 0x00007f53ed6ed198 in QCoreApplication::notifyInternal2 (receiver=0x1d0d5c0, event=0x7ffcbc8a7fa0) at kernel/qcoreapplication.cpp:1064
#26 0x00007f53ed6ed36e in QCoreApplication::sendSpontaneousEvent (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1474
#27 0x00007f53ee3ab92e in QApplicationPrivate::sendMouseEvent (receiver=0x1d0d5c0, event=event@entry=0x7ffcbc8a7fa0, alienWidget=<optimized out>, nativeWidget=0x1d0ca20, buttonDown=buttonDown@entry=0x7f53ee8f2330 <qt_button_down>, lastMouseReceiver=..., spontaneous=true, onlyDispatchEnterLeave=false) at kernel/qapplication.cpp:2622
#28 0x00007f53ee4002ba in QWidgetWindow::handleMouseEvent (this=this@entry=0x1d375c0, event=event@entry=0x7ffcbc8a8250) at kernel/qwidgetwindow.cpp:580
#29 0x00007f53ee402d0f in QWidgetWindow::event (this=0x1d375c0, event=0x7ffcbc8a8250) at kernel/qwidgetwindow.cpp:300
#30 0x00007f53ee3a519e in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x1d375c0, e=0x7ffcbc8a8250) at kernel/qapplication.cpp:3640
#31 0x00007f53ed6ed198 in QCoreApplication::notifyInternal2 (receiver=0x1d375c0, event=0x7ffcbc8a8250) at kernel/qcoreapplication.cpp:1064
#32 0x00007f53ed6ed36e in QCoreApplication::sendSpontaneousEvent (receiver=<optimized out>, event=<optimized out>) at kernel/qcoreapplication.cpp:1474
#33 0x00007f53edb7d0db in QGuiApplicationPrivate::processMouseEvent (e=0x19b3530) at kernel/qguiapplication.cpp:2285
#34 0x00007f53edb5038c in QWindowSystemInterface::sendWindowSystemEvents (flags=flags@entry=...) at kernel/qwindowsysteminterface.cpp:1169
#35 0x00007f53de8f854a in xcbSourceDispatch (source=<optimized out>) at qxcbeventdispatcher.cpp:105
#36 0x00007f53ea2b1f30 in ?? () from /lib64/libglib-2.0.so.0
#37 0x00007f53ea2b3b58 in ?? () from /lib64/libglib-2.0.so.0
#38 0x00007f53ea2b420c in g_main_context_iteration () from /lib64/libglib-2.0.so.0
#39 0x00007f53ed7460d6 in QEventDispatcherGlib::processEvents (this=0x1324f40, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#40 0x00007f53ed6ebc2b in QEventLoop::exec (this=this@entry=0x7ffcbc8a8580, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#41 0x00007f53ed6f40c0 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#42 0x0000000000472a68 in main (argc=2, argv=0x7ffcbc8a8c88) at /home/victor/kphotoalbum/main.cpp:161
[Inferior 1 (process 7467) detached]
Comment 1 Johannes Zarl-Zierl 2023-11-27 22:57:29 UTC
I can reproduce the crash. It can also be reproduced by renaming a category and then picking it as Category for untagged images.
Comment 2 Johannes Zarl-Zierl 2023-11-27 23:46:06 UTC
Git commit 67a8cdf455673bbcd9d9e54a54998cbb3a53853b by Johannes Zarl-Zierl.
Committed on 28/11/2023 at 00:45.
Pushed by johanneszarl into branch 'master'.

Fix crash when renaming or adding a category and using it as untagged category

When trying to select an unsaved category (either newly created or renamed)
as the untagged category in the category settings page, instead of
populating the tag dropdown list, kphotoalbum would crash.

The new behavior is to disable the tag dropdown instead.

M  +1    -0    CHANGELOG.md
M  +9    -5    Settings/UntaggedGroupBox.cpp

https://invent.kde.org/graphics/kphotoalbum/-/commit/67a8cdf455673bbcd9d9e54a54998cbb3a53853b