Bug 470225 - Segfault after hiding reconciled transactions
Summary: Segfault after hiding reconciled transactions
Status: RESOLVED WORKSFORME
Alias: None
Product: kmymoney
Classification: Applications
Component: general (show other bugs)
Version: git (master)
Platform: macOS (DMG) macOS
: NOR crash
Target Milestone: ---
Assignee: KMyMoney Devel Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-05-24 19:53 UTC by Dawid Wróbel
Modified: 2024-09-13 03:47 UTC (History)
1 user (show)

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


Attachments
Backtrace with QTimer event involved (4.84 KB, text/x-log)
2024-08-13 07:41 UTC, Ralf Habacker
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dawid Wróbel 2023-05-24 19:53:31 UTC
SUMMARY
I git a segfault after enabling "Hide reconciled transactions". This was after a fairly long session with the app. I couldn't reproduce it after starting a new session. 

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libkmm_models.5.1.80.dylib    	       0x109c86784 LedgerSortProxyModel::setHideReconciledTransactions(bool) + 4
1   kmymoney                      	       0x100bcfdbf 0x100b14000 + 769471
2   QtCore                        	       0x10fbb3664 void doActivate<false>(QObject*, int, void**) + 1124
3   QtCore                        	       0x10fbb3664 void doActivate<false>(QObject*, int, void**) + 1124
4   QtCore                        	       0x10fbbc722 QTimer::timerEvent(QTimerEvent*) + 98
5   QtCore                        	       0x10fbab711 QObject::event(QEvent*) + 113
6   QtWidgets                     	       0x10d6ad3b6 QApplicationPrivate::notify_helper(QObject*, QEvent*) + 262
7   QtWidgets                     	       0x10d6ae770 QApplication::notify(QObject*, QEvent*) + 480
8   QtCore                        	       0x10fb82957 QCoreApplication::notifyInternal2(QObject*, QEvent*) + 167
9   QtCore                        	       0x10fbe38da QTimerInfoList::activateTimers() + 1002
10  libqcocoa.dylib               	       0x11298c122 QCocoaEventDispatcherPrivate::activateTimersSourceCallback(void*) + 18
11  CoreFoundation                	    0x7ff814c7ea36 __CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17
12  CoreFoundation                	    0x7ff814c7e9d9 __CFRunLoopDoSource0 + 157
13  CoreFoundation                	    0x7ff814c7e7b6 __CFRunLoopDoSources0 + 217
14  CoreFoundation                	    0x7ff814c7d43a __CFRunLoopRun + 916
15  CoreFoundation                	    0x7ff814c7ca4c CFRunLoopRunSpecific + 560
16  HIToolbox                     	    0x7ff81ebaefcd RunCurrentEventLoopInMode + 292
17  HIToolbox                     	    0x7ff81ebaedde ReceiveNextEventCommon + 657
18  HIToolbox                     	    0x7ff81ebaeb38 _BlockUntilNextEventMatchingListInModeWithFilter + 64
19  AppKit                        	    0x7ff817c6e7a0 _DPSNextEvent + 858
20  AppKit                        	    0x7ff817c6d64a -[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1214
21  AppKit                        	    0x7ff817c5fcb8 -[NSApplication run] + 586
22  libqcocoa.dylib               	       0x11298ccba QCocoaEventDispatcher::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) + 2090
23  QtCore                        	       0x10fb7ef47 QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) + 471
24  QtCore                        	       0x10fb82ef2 QCoreApplication::exec() + 130
25  kmymoney                      	       0x100b2a2a7 0x100b14000 + 90791
26  kmymoney                      	       0x100b28e81 0x100b14000 + 85633
27  dyld                          	       0x200e6841f start + 1903


STEPS TO REPRODUCE
1. 
2. 
3. 

OBSERVED RESULT


EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 Thomas Baumgart 2024-08-12 12:12:54 UTC
Should we keep this open since you cannot reproduce the problem or simply close it?
Comment 2 Ralf Habacker 2024-08-12 14:13:13 UTC
(In reply to Dawid Wróbel from comment #0)
> LedgerSortProxyModel::setHideReconciledTransactions(bool) + 4

In KTagsView::showEvent() there is a connect between changed settings event and this method as target: 

        connect(LedgerViewSettings::instance(), &LedgerViewSettings::settingsChanged, this, [&]() {
            Q_D(KTagsView);
            d->m_transactionFilter->setHideReconciledTransactions(LedgerViewSettings::instance()->hideReconciledTransactions());
            d->m_transactionFilter->setHideTransactionsBefore(LedgerViewSettings::instance()->hideTransactionsBefore());

It crashes when d->m_transactionFilter is null.  I didn't see any disconnection in the constructor. If the mentioned event is triggered after this object has already been destroyed, this can happen. A similar pattern is also used in the KPayeesView and LedgerViewPage classes.
Comment 3 Ralf Habacker 2024-08-12 14:14:12 UTC
(In reply to Ralf Habacker from comment #2)
> It crashes when d->m_transactionFilter is null.  I didn't see any disconnection in the constructor. 
S/constructor/destructor
Comment 4 Thomas Baumgart 2024-08-13 07:09:48 UTC
Connections are automatically removed when either the sender or the receiver object gets destroyed. Also, as a side note, it seems that the private data pointed to by d gets deleted prior to filter object pointed to by m_transactionFilter. Since the connection is only setup when d and m_transactionFilter are not null I don't see a problem here.

The original BT shows that something happened due to a QTimer event.
Comment 5 Ralf Habacker 2024-08-13 07:41:03 UTC
Created attachment 172575 [details]
Backtrace with QTimer event involved

This backtrace is generated after switching the state of the "view"->"hide reconciled transaction" menu entry.
Comment 6 Thomas Baumgart 2024-08-14 09:23:40 UTC
How can I duplicate/provoke this problem? I tried a few things but never got a crash. It always works for me, so there must be something I am missing / doing different.
Comment 7 Bug Janitor Service 2024-08-29 03:47:53 UTC
🐛🧹 ⚠️ This bug has been in NEEDSINFO status with no change for at least 15 days. Please provide the requested information, then set the bug status to REPORTED. If there is no change for at least 30 days, it will be automatically closed as RESOLVED WORKSFORME.

For more information about our bug triaging procedures, please read https://community.kde.org/Guidelines_and_HOWTOs/Bug_triaging.

Thank you for helping us make KDE software even better for everyone!
Comment 8 Bug Janitor Service 2024-09-13 03:47:09 UTC
🐛🧹 This bug has been in NEEDSINFO status with no change for at least 30 days. Closing as RESOLVED WORKSFORME.