Bug 506454 - Crash when entering scheduled transaction
Summary: Crash when entering scheduled transaction
Status: RESOLVED FIXED
Alias: None
Product: kmymoney
Classification: Applications
Component: general (other bugs)
Version First Reported In: 5.2.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-07-01 19:21 UTC by Ingo Klöcker
Modified: 2025-07-02 19:58 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In: 5.2.1
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ingo Klöcker 2025-07-01 19:21:32 UTC
KMyMoney crashes when trying to enter a due scheduled transaction shown in the ledger.

STEPS TO REPRODUCE
1. I have a few ledgers open in tabs.
2. Ctrl+7 to switch to Ledgers.
3. Tab Tab Tab ... until first ledger tab (in tab bar) has focus.
4. Right Right ... until ledger with due scheduled transaction has focus.
5. Tab Tab to give focus to list view.
6. Up Down to see last entered transaction. (This is a workaround because the list view should really scroll to the current/selected transaction.)
7. Down to select scheduled transaction.
8. Ctrl+Shift+Insert to insert scheduled transaction.

CRASH

#0  QAbstractItemView::selectionModel (this=0x0)
    at /usr/src/debug/qtbase-everywhere-src-6.9.1/src/widgets/itemviews/qabstractitemview.cpp:837
#1  0x00005555556dc734 in KScheduledViewPrivate::selectedSchedule (this=0x555555fe1850, action=<optimized out>)
    at /usr/src/debug/kmymoney-5.2.0/kmymoney/views/kscheduledview_p.h:386
#2  0x00005555556e5aa6 in KScheduledView::slotEnterSchedule (this=0x555555e106f0)
    at /usr/src/debug/kmymoney-5.2.0/kmymoney/views/kscheduledview.cpp:245
#3  0x00007ffff54199a1 in QtPrivate::QSlotObjectBase::call
    (this=0x55555607e410, r=<optimized out>, a=0x7fffffffcaa0, this=<optimized out>, r=<optimized out>, a=<optimized out>)
    at /usr/src/debug/qtbase-everywhere-src-6.9.1/src/corelib/kernel/qobjectdefs_impl.h:461
#4  doActivate<false> (sender=0x5555560753d0, signal_index=7, argv=0x7fffffffcaa0)
    at /usr/src/debug/qtbase-everywhere-src-6.9.1/src/corelib/kernel/qobject.cpp:4146
#5  0x00007ffff5fcb8e6 in QMetaObject::activate<void, bool>
    (sender=0x5555560753d0, mo=0x7ffff634cbc0, local_signal_index=4, ret=0x0, sender=<optimized out>, mo=<optimized out>, local_signal_index=<optimized out>, ret=<optimized out>) at /usr/src/debug/qtbase-everywhere-src-6.9.1/src/corelib/kernel/qobjectdefs.h:306
#6  QAction::triggered (this=this@entry=0x5555560753d0, _t1=<optimized out>)
    at /usr/src/debug/qtbase-everywhere-src-6.9.1/build/src/gui/Gui_autogen/include/moc_qaction.cpp:372
[...]

Obviously, the selection model is nullptr.
Comment 1 Ingo Klöcker 2025-07-01 19:25:40 UTC
It doesn't crash if I do 1.-7. as above and then
8. Press menu key (to open context menu on scheduled transaction).
9. Press Down until Enter next transaction
10. Press Return
Comment 2 Ingo Klöcker 2025-07-01 19:35:03 UTC
Oh. Very interesting. After successfully entering a scheduled transaction (see previous comment) I went to the next ledger, selected a scheduled transaction with the keyboard and pressed Ctrl+Shift+Insert.

Very much to my surprise I'm now offered the next scheduled transaction of the previous ledger. It seems that the selection model (that was 0 when it crashed) is still pointing to the item in the item model belonging to the previous ledger. Apparently, the selection model is not properly initialized/reset when a ledger is entered.
Comment 3 Thomas Baumgart 2025-07-02 17:36:27 UTC
I was able to reproduce the problem but only after I assigned that shortcut to the action.
Comment 4 Thomas Baumgart 2025-07-02 18:20:14 UTC
Git commit 832128ca75d5ad9e15a86ebf3ae59afae9a01c22 by Thomas Baumgart.
Committed on 02/07/2025 at 18:19.
Pushed by tbaumgart into branch '5.2'.

Figure out the schedule when entering through shortcut
FIXED-IN: 5.2.1

M  +7    -6    kmymoney/views/kscheduledview.cpp
M  +16   -6    kmymoney/views/kscheduledview_p.h

https://invent.kde.org/office/kmymoney/-/commit/832128ca75d5ad9e15a86ebf3ae59afae9a01c22
Comment 5 Thomas Baumgart 2025-07-02 18:20:49 UTC
Git commit 3765702bf08995056cc73cfa7341bb2052f93ec9 by Thomas Baumgart.
Committed on 02/07/2025 at 18:20.
Pushed by tbaumgart into branch 'master'.

Figure out the schedule when entering through shortcut
FIXED-IN: 5.2.1
(cherry picked from commit 832128ca75d5ad9e15a86ebf3ae59afae9a01c22)

M  +7    -6    kmymoney/views/kscheduledview.cpp
M  +16   -6    kmymoney/views/kscheduledview_p.h

https://invent.kde.org/office/kmymoney/-/commit/3765702bf08995056cc73cfa7341bb2052f93ec9
Comment 6 Ingo Klöcker 2025-07-02 19:58:45 UTC
It's possible that I assigned this shortcut ages ago. Thanks for the quick fix!