[network/neochat] src/spaces/models: Blind fix for SpaceChildrenModel crash
Joshua Goins <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 66bea0ba6da464949584b023c661318caa809ab3 by Joshua Goins.
Committed on 26/07/2026 at 15:51.
Pushed by redstrate into branch 'master'.
Blind fix for SpaceChildrenModel crash
Fixes this ASan error I saw while messing around in the UI:
==212023==ERROR: AddressSanitizer: heap-use-after-free on address 0x7c70de90e740 at pc 0x0000016e92e6 bp 0x7fff387da730 sp 0x7fff387da728
READ of size 8 at 0x7c70de90e740 thread T0
#0 0x0000016e92e5 in operator()<Quotient::GetSpaceHierarchyJob*> /home/josh/kde/src/neochat/src/spaces/models/spacechildrenmodel.cpp:88
#1 0x0000016e962f in callFn<> /home/josh/kde/usr/include/Quotient/jobs/jobhandle.h:229
#2 0x0000016e96b9 in operator() /home/josh/kde/usr/include/Quotient/jobs/jobhandle.h:219
#3 0x0000016e97ef in operator() /home/josh/kde/usr/include/Quotient/jobs/jobhandle.h:290
#4 0x000001702a86 in __invoke_impl<Quotient::GetSpaceHierarchyJob*, Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::combineContinuations<SpaceChildrenModel::refreshModel()::<lambda(const auto:114&)>, Skip>(SpaceChildrenModel::refreshModel()::<lambda(const auto:114&)>&&, Skip&&, Skip)::<lambda(Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::future_value_type)>&, Quotient::GetSpaceHierarchyJob*> /usr/include/c++/15/bits/invoke.h:63
#5 0x000001702568 in __invoke<Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::combineContinuations<SpaceChildrenModel::refreshModel()::<lambda(const auto:114&)>, Skip>(SpaceChildrenModel::refreshModel()::<lambda(const auto:114&)>&&, Skip&&, Skip)::<lambda(Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::future_value_type)>&, Quotient::GetSpaceHierarchyJob*> /usr/include/c++/15/bits/invoke.h:98
#6 0x000001701e7e in invoke<Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::combineContinuations<SpaceChildrenModel::refreshModel()::<lambda(const auto:114&)>, Skip>(SpaceChildrenModel::refreshModel()::<lambda(const auto:114&)>&&, Skip&&, Skip)::<lambda(Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::future_value_type)>&, Quotient::GetSpaceHierarchyJob*> /usr/include/c++/15/functional:122
#7 0x000001701271 in fulfillPromise<Quotient::GetSpaceHierarchyJob*> /usr/include/qt6/QtCore/qfuture_impl.h:648
#8 0x0000016ffd60 in fulfillPromiseWithResult /usr/include/qt6/QtCore/qfuture_impl.h:620
#9 0x0000016fe888 in runFunction /usr/include/qt6/QtCore/qfuture_impl.h:422
#10 0x0000016fea6e in runImpl /usr/include/qt6/QtCore/qfuture_impl.h:349
#11 0x0000016fbb60 in execute /usr/include/qt6/QtCore/qfuture_impl.h:482
#12 0x0000016f80a3 in operator() /usr/include/qt6/QtCore/qfuture_impl.h:548
#13 0x000001701fde in operator()<> /usr/include/qt6/QtCore/qfuture_impl.h:501
#14 0x0000017015c9 in __invoke_impl<void, QtPrivate::ContinuationWrapper<QtPrivate::CompactContinuation<Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::combineContinuations<SpaceChildrenModel::refreshModel()::<lambda(const auto:114&)>, Skip>(SpaceChildrenModel::refreshModel()::<lambda(const auto:114&)>&&, Skip&&, Skip)::<lambda(Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::future_value_type)>, Quotient::GetSpaceHierarchyJob*, Quotient::GetSpaceHierarchyJob*>::create<Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::combineContinuations<SpaceChildrenModel::refreshModel()::<lambda(const auto:114&)>, Skip>(SpaceChildrenModel::refreshModel()::<lambda(const auto:114&)>&&, Skip&&, Skip)::<lambda(Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::future_value_type)> >(Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::combineContinuations<SpaceChildrenModel::refreshModel()::<lambda(const auto:114&)>, Skip>(SpaceChildrenModel::refreshModel()::<lambda(const auto:114&)>&&, Skip&&, Skip)::<lambda(Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::future_value_type)>&&, QFuture<Quotient::GetSpaceHierarchyJob*>*, QFutureInterface<Quotient::GetSpaceHierarchyJob*>&, QtFuture::Launch)::<lambda(const QFutureInterfaceBase&)> >&, const QFutureInterfaceBase&> /usr/include/c++/15/bits/invoke.h:63
#15 0x0000017003b2 in __invoke_r<void, QtPrivate::ContinuationWrapper<QtPrivate::CompactContinuation<Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::combineContinuations<SpaceChildrenModel::refreshModel()::<lambda(const auto:114&)>, Skip>(SpaceChildrenModel::refreshModel()::<lambda(const auto:114&)>&&, Skip&&, Skip)::<lambda(Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::future_value_type)>, Quotient::GetSpaceHierarchyJob*, Quotient::GetSpaceHierarchyJob*>::create<Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::combineContinuations<SpaceChildrenModel::refreshModel()::<lambda(const auto:114&)>, Skip>(SpaceChildrenModel::refreshModel()::<lambda(const auto:114&)>&&, Skip&&, Skip)::<lambda(Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::future_value_type)> >(Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::combineContinuations<SpaceChildrenModel::refreshModel()::<lambda(const auto:114&)>, Skip>(SpaceChildrenModel::refreshModel()::<lambda(const auto:114&)>&&, Skip&&, Skip)::<lambda(Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::future_value_type)>&&, QFuture<Quotient::GetSpaceHierarchyJob*>*, QFutureInterface<Quotient::GetSpaceHierarchyJob*>&, QtFuture::Launch)::<lambda(const QFutureInterfaceBase&)> >&, const QFutureInterfaceBase&> /usr/include/c++/15/bits/invoke.h:113
#16 0x0000016fee56 in _M_invoke /usr/include/c++/15/bits/std_function.h:292
#17 0x7f50e62e0968 in QFutureInterfaceBase::runContinuation() const (/lib64/libQt6Core.so.6+0x2e0968) (BuildId: 57b90aad48f5666b281586e31ae0b1b4d8b68117)
#18 0x00000172032a in QFutureInterface<Quotient::GetSpaceHierarchyJob*>::reportFinished() /usr/include/qt6/QtCore/qfutureinterface.h:285
#19 0x00000171bb72 in QPromise<Quotient::GetSpaceHierarchyJob*>::finish() /usr/include/qt6/QtCore/qpromise.h:76
#20 0x000001727240 in QtPrivate::CompactContinuation<Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::createFrom<QString const&, std::nullopt_t const&, std::nullopt_t const&, int>(QString const&, std::nullopt_t const&, std::nullopt_t const&, int&&)::{lambda()#1}, Quotient::GetSpaceHierarchyJob*, void>::runFunction() /usr/include/qt6/QtCore/qfuture_impl.h:451
#21 0x0000017273b4 in QtPrivate::CompactContinuation<Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::createFrom<QString const&, std::nullopt_t const&, std::nullopt_t const&, int>(QString const&, std::nullopt_t const&, std::nullopt_t const&, int&&)::{lambda()#1}, Quotient::GetSpaceHierarchyJob*, void>::runImpl() /usr/include/qt6/QtCore/qfuture_impl.h:349
#22 0x0000017235bc in QtPrivate::CompactContinuation<Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::createFrom<QString const&, std::nullopt_t const&, std::nullopt_t const&, int>(QString const&, std::nullopt_t const&, std::nullopt_t const&, int&&)::{lambda()#1}, Quotient::GetSpaceHierarchyJob*, void>::execute() /usr/include/qt6/QtCore/qfuture_impl.h:482
#23 0x00000171f0fb in QtPrivate::CompactContinuation<Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::createFrom<QString const&, std::nullopt_t const&, std::nullopt_t const&, int>(QString const&, std::nullopt_t const&, std::nullopt_t const&, int&&)::{lambda()#1}, Quotient::GetSpaceHierarchyJob*, void>::create<Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::createFrom<QString const&, std::nullopt_t const&, std::nullopt_t const&, int>(QString const&, std::nullopt_t const&, std::nullopt_t const&, int&&)::{lambda()#1}>(Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::createFrom<QString const&, std::nullopt_t const&, std::nullopt_t const&, int>(QString const&, std::nullopt_t const&, std::nullopt_t const&, int&&)::{lambda()#1}&&, QFuture<void>*, QFutureInterface<Quotient::GetSpaceHierarchyJob*>&, QtFuture::Launch)::{lambda(QFutureInterfaceBase const&)#1}::operator()(QFutureInterfaceBase const&) /usr/include/qt6/QtCore/qfuture_impl.h:548
#24 0x00000172bdaa in void QtPrivate::ContinuationWrapper<QtPrivate::CompactContinuation<Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::createFrom<QString const&, std::nullopt_t const&, std::nullopt_t const&, int>(QString const&, std::nullopt_t const&, std::nullopt_t const&, int&&)::{lambda()#1}, Quotient::GetSpaceHierarchyJob*, void>::create<Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::createFrom<QString const&, std::nullopt_t const&, std::nullopt_t const&, int>(QString const&, std::nullopt_t const&, std::nullopt_t const&, int&&)::{lambda()#1}>(Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::createFrom<QString const&, std::nullopt_t const&, std::nullopt_t const&, int>(QString const&, std::nullopt_t const&, std::nullopt_t const&, int&&)::{lambda()#1}&&, QFuture<void>*, QFutureInterface<Quotient::GetSpaceHierarchyJob*>&, QtFuture::Launch)::{lambda(QFutureInterfaceBase const&)#1}>::operator()<QtPrivate::CompactContinuation<Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::createFrom<QString const&, std::nullopt_t const&, std::nullopt_t const&, int>(QString const&, std::nullopt_t const&, std::nullopt_t const&, int&&)::{lambda()#1}, Quotient::GetSpaceHierarchyJob*, void>::create<Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::createFrom<QString const&, std::nullopt_t const&, std::nullopt_t const&, int>(QString const&, std::nullopt_t const&, std::nullopt_t const&, int&&)::{lambda()#1}>(Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::createFrom<QString const&, std::nullopt_t const&, std::nullopt_t const&, int>(QString const&, std::nullopt_t const&, std::nullopt_t const&, int&&)::{lambda()#1}&&, QFuture<void>*, QFutureInterface<Quotient::GetSpaceHierarchyJob*>&, QtFuture::Launch)::{lambda(QFutureInterfaceBase const&)#1}, true>(QFutureInterfaceBase const&) /usr/include/qt6/QtCore/qfuture_impl.h:501
#25 0x00000172b0c5 in void std::__invoke_impl<void, QtPrivate::ContinuationWrapper<QtPrivate::CompactContinuation<Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::createFrom<QString const&, std::nullopt_t const&, std::nullopt_t const&, int>(QString const&, std::nullopt_t const&, std::nullopt_t const&, int&&)::{lambda()#1}, Quotient::GetSpaceHierarchyJob*, void>::create<Quotient::JobHandle<Quotient::GetSpaceHierarchyJob>::createFrom<QString const&, std::nullopt_t const&, std::nullopt_t const&, int>(QString const&, std::nullopt_t const&, std::nullopt_t const&, int&&)::{lambda()#1}>(Quotient::JobHandle<Q
M +5 -0 src/spaces/models/spacechildrenmodel.cpp
https://invent.kde.org/network/neochat/-/commit/66bea0ba6da464949584b023c661318caa809ab3
diff --git a/src/spaces/models/spacechildrenmodel.cpp b/src/spaces/models/spacechildrenmodel.cpp
index 105328356..ecc32b9dc 100644
--- a/src/spaces/models/spacechildrenmodel.cpp
+++ b/src/spaces/models/spacechildrenmodel.cpp
@@ -16,6 +16,11 @@ SpaceChildrenModel::SpaceChildrenModel(QObject *parent)
SpaceChildrenModel::~SpaceChildrenModel()
{
+ for (const auto &job : m_currentJobs) {
+ if (job) {
+ job->abandon();
+ }
+ }
delete m_rootItem;
}