https://bugs.kde.org/show_bug.cgi?id=488305

            Bug ID: 488305
           Summary: efb72652ce9596c59298563bf0d86b65f6cfc7bc causes
                    NeoChat to crash when I try to reply to a specific
                    message
    Classification: Applications
           Product: NeoChat
           Version: git master
          Platform: Other
                OS: Linux
            Status: REPORTED
          Keywords: regression
          Severity: crash
          Priority: NOR
         Component: General
          Assignee: fe...@posteo.de
          Reporter: n...@kde.org
                CC: c...@carlschwan.eu, james.h.gra...@protonmail.com
  Target Milestone: ---

STEPS TO REPRODUCE
1. Be me. Unsure if this is required, but the message in question is a direct
reply to something I wrote. Possibly it will not reproduce for you, but will
reproduce with a reply to one of *your* messages?
2. Locate the message with URL
https://matrix.to/#/!cbhzHdSgDDghlosjCd:kde.org/$akgrkqxEnXWSeFCxooTPPGnwEGsqF1bJJ5F9Jk0SjsA
3. Hover over it and click on the Reply button


OBSERVED RESULT
NeoChat crashes 100% of the time with this backtrace:

(gdb) bt
#0  __pthread_kill_implementation
    (threadid=<optimized out>, signo=signo@entry=11, no_tid=no_tid@entry=0) at
pthread_kill.c:44
#1  0x00007f6020eab1b3 in __pthread_kill_internal (threadid=<optimized out>,
signo=11)
    at pthread_kill.c:78
#2  0x00007f6020e5365e in __GI_raise (sig=11) at ../sysdeps/posix/raise.c:26
#3  0x00007f602514d9a3 in KCrash::defaultCrashHandler (sig=11)
    at /home/nate/kde/src/kcrash/src/kcrash.cpp:597
#4  0x00007f6020e53710 in <signal handler called> () at /lib64/libc.so.6
#5  0x00007f6021641a91 in QArrayDataPointer<QtCbor::Element>::constEnd
(this=<optimized out>)
    at
/usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/tools/qarraydatapointer.h:127
#6  QList<QtCbor::Element>::constEnd (this=<optimized out>)
    at
/usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/tools/qlist.h:619
#7  indexOf<QLatin1String> (o=..., key=...,
keyExists=keyExists@entry=0x7ffda10429cf)
    at
/usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/serialization/qjsonobject.cpp:262
#8  0x00007f60216425fb in QJsonObject::valueImpl<QLatin1String>
(this=0x644eda8, key=...)
    at
/usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/serialization/qjsonobject.cpp:314
#9  QJsonObject::value (this=0x644eda8, key=...)
    at
/usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/serialization/qjsonobject.cpp:301
#10 0x00007f6023f95db9 in QJsonObject::operator[] (this=<optimized out>,
key=...)
    at /usr/include/qt6/QtCore/qjsonobject.h:61
#11 Quotient::RoomEvent::id (this=<optimized out>)
    at /home/nate/kde/src/libquotient/Quotient/events/roomevent.cpp:24
#12 0x0000000000724fba in operator()
    (__closure=0x6542d80, oldEventId=<optimized out>, newEventId=<optimized
out>)
    at /home/nate/kde/src/neochat/src/models/messagecontentmodel.cpp:134
#13 QtPrivate::FunctorCall<QtPrivate::IndexesList<0, 1>, QtPrivate::List<const
QString&, const QString&>, void,
MessageContentModel::initializeModel()::<lambda(const QString&, const
QString&)> >::call
    (f=..., arg=<optimized out>) at
/usr/include/qt6/QtCore/qobjectdefs_impl.h:137
#14
QtPrivate::FunctorCallable<MessageContentModel::initializeModel()::<lambda(const
QString&, const QString&)>, const QString&, const
QString&>::call<QtPrivate::List<QString const&, QString const&>, void> (f=...,
arg=<optimized out>) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:345
#15
QtPrivate::QCallableObject<MessageContentModel::initializeModel()::<lambda(const
QString&, const QString&)>, QtPrivate::List<const QString&, const QString&>,
void>::impl(int, QtPrivate::QSlotObjectBase *, QObject *, void **, bool *)
    (which=<optimized out>, this_=0x6542d70, r=<optimized out>, a=<optimized
out>, ret=<optimized out>) at /usr/include/qt6/QtCore/qobjectdefs_impl.h:555
#16 0x00007f60215fa752 in QtPrivate::QSlotObjectBase::call
    (this=0x6542d70, r=<optimized out>, a=0x7ffda1042bc0)
    at
/usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/kernel/qobjectdefs_impl.h:469
#17 doActivate<false> (sender=0x467c630, signal_index=4, argv=0x7ffda1042bc0)
    at
/usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/kernel/qobject.cpp:4086
#18 0x00007f60215f0b47 in QMetaObject::activate
    (sender=sender@entry=0x467c630, m=m@entry=0x81cc60
<ChatBarCache::staticMetaObject>,
local_signal_index=local_signal_index@entry=1, argv=argv@entry=0x7ffda1042bc0)
    at
/usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/kernel/qobject.cpp:4146
#19 0x00000000005b7105 in ChatBarCache::relationIdChanged (this=0x467c630,
_t1=..., _t2=...)
--Type <RET> for more, q to quit, c to continue without paging--c
    at
/home/nate/kde/build/neochat/src/neochat_autogen/include/moc_chatbarcache.cpp:318
#20 ChatBarCache::setEditId (this=0x467c630, editId=...)
    at /home/nate/kde/src/neochat/src/chatbarcache.cpp:83
#21 0x00000000005b802b in ChatBarCache::qt_metacall
    (this=0x467c630, _c=QMetaObject::WriteProperty, _id=4, _a=0x7ffda1042df0)
    at
/home/nate/kde/build/neochat/src/neochat_autogen/include/moc_chatbarcache.cpp:302
#22 0x00007f6024443075 in QV4::QObjectWrapper::setProperty
    (engine=engine@entry=0x233aef0, object=object@entry=0x467c630,
property=0x664aa10, value=...)
    at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/src/qml/qml/qqmlpropertydata_p.h:256
#23 0x00007f6024443fbe in QV4::QObjectWrapper::setQmlProperty
    (engine=engine@entry=0x233aef0, qmlContext=..., object=0x467c630,
name=<optimized out>, flags=flags@entry=..., value=...)
    at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/src/qml/jsruntime/qv4qobjectwrapper.cpp:567
#24 0x00007f6024444175 in QV4::QObjectWrapper::virtualPut
    (m=0x7f60041bf538, id=..., value=..., receiver=0x7f60041bf538)
    at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/src/qml/jsruntime/qv4qobjectwrapper.cpp:939
#25 0x00007f602441c200 in QV4::Object::put
    (this=0x7f60041bf538, id=..., v=<optimized out>, receiver=0x7f60041bf538)
    at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/src/qml/jsruntime/qv4object_p.h:41
#26 QV4::Object::virtualResolveLookupSetter
    (object=0x7f60041bf538, engine=0x233aef0, lookup=0x5ff15f0,
value=<optimized out>)
    at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/src/qml/jsruntime/qv4object.cpp:817
#27 0x00007f60244aa435 in QV4::Moth::VME::interpret (frame=0x644eda8, 
    frame@entry=0x7ffda10432a0, engine=0x233aef0, code=0x7f5feaf56cab
".o\030\a\254p\a")
    at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/src/qml/jsruntime/qv4vme_moth.cpp:703
#28 0x00007f60244ae59f in QV4::Moth::VME::exec
    (frame=frame@entry=0x7ffda10432a0, engine=engine@entry=0x233aef0)
    at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/src/qml/jsruntime/qv4vme_moth.cpp:487
#29 0x00007f60243efce6 in QV4::doCall
    (self=<optimized out>, thisObject=thisObject@entry=0x7f60041bf4f0,
argv=<optimized out>, argc=argc@entry=1, context=<optimized out>)
    at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/src/qml/jsruntime/qv4function.cpp:54
#30 0x00007f60243f01ed in QV4::Function::call
    (this=this@entry=0x5726580, thisObject=0x7f60041bf4f0,
argv=argv@entry=0x7f60041bf4f0, argc=argc@entry=1,
context=context@entry=0x7f5feaa13668)
    at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/src/qml/jsruntime/qv4function.cpp:79
#31 0x00007f60243f0509 in operator()
    (__closure=<synthetic pointer>, thisObject=<optimized out>,
argv=0x7f60041bf4f0, argc=1)
    at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/src/qml/jsruntime/qv4function.cpp:30
#32 QV4::convertAndCall<QV4::Function::call(QObject*, void**, const QMetaType*,
int, QV4::ExecutionContext*)::<lambda(const QV4::Value*, const QV4::Value*,
int)> >
    (engine=<optimized out>, thisObject=0x58ec130, a=0x7ffda1045050,
types=0x7ffda10435b8, argc=1, call=...) at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/src/qml/jsruntime/qv4jscall_p.h:202
#33 QV4::Function::call
    (this=0x5726580, thisObject=0x58ec130, a=a@entry=0x7ffda1045050,
types=0x7ffda10435b8, argc=1, context=0x7f5feaa13668)
    at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/src/qml/jsruntime/qv4function.cpp:27
#34 0x00007f60245683f7 in QQmlJavaScriptExpression::evaluate
    (this=this@entry=0x5899410, a=a@entry=0x7ffda1045050, types=<optimized
out>, argc=argc@entry=1)
    at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/src/qml/qml/qqmljavascriptexpression_p.h:248
#35 0x00007f6024506afd in QQmlBoundSignalExpression::evaluate
    (this=0x5899410, a=a@entry=0x7ffda1045050) at
/usr/include/qt6/QtCore/qvarlengtharray.h:85
#36 0x00007f6024507650 in QQmlBoundSignal_callback (e=0x2719690,
a=0x7ffda1045050)
    at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/src/qml/qml/ftw/qqmlrefcount_p.h:73
#37 0x00007f6024596425 in QQmlNotifier::emitNotify (endpoint=<optimized out>,
a=0x7ffda1045050)
    at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/src/qml/qml/qqmlnotifier.cpp:70
#38 0x00007f60215fa29d in doActivate<false> (sender=0x58ec130, signal_index=11,
argv=0x7ffda1045050)
    at
/usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/kernel/qobject.cpp:3976
#39 0x00007f60215f0b47 in QMetaObject::activate
    (sender=sender@entry=0x58ec130, m=m@entry=0x7f601ee3b720
<QQuickAction::staticMetaObject>,
local_signal_index=local_signal_index@entry=8, argv=argv@entry=0x7ffda1045050)
    at
/usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/kernel/qobject.cpp:4146
#40 0x00007f601ecd6204 in QQuickAction::triggered (this=this@entry=0x58ec130,
_t1=<optimized out>, 
    _t1@entry=0x27a7d60)
    at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/redhat-linux-build/src/quicktemplates/QuickTemplates2_autogen/include/moc_qquickaction_p.cpp:401
#41 0x00007f601ecd7359 in QQuickActionPrivate::trigger
    (this=0x58ec200, source=0x27a7d60, doToggle=false)
    at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/src/quicktemplates/qquickaction.cpp:528
#42 0x00007f601eccdfa8 in QQuickAbstractButtonPrivate::trigger
    (this=this@entry=0x566d2c0, doubleClick=doubleClick@entry=false)
    at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/src/quicktemplates/qquickabstractbutton.cpp:374
#43 0x00007f601ecd0d9a in QQuickAbstractButtonPrivate::handleRelease
    (this=0x566d2c0, point=..., timestamp=1304062)
    at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/src/quicktemplates/qquickabstractbutton.cpp:186
#44 0x00007f601ece8dd5 in QQuickControl::mouseReleaseEvent
    (this=<optimized out>, event=0x7ffda1045d00)
    at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/src/quicktemplates/qquickcontrol.cpp:2027
#45 0x00007f6024c0c5cf in QQuickItemPrivate::deliverPointerEvent
    (this=this@entry=0x566d2c0, event=event@entry=0x7ffda1045d00)
    at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/src/quick/items/qquickitem.cpp:5632
#46 0x00007f6024c0c753 in QQuickItem::event (this=0x27a7d60, ev=0x7ffda1045d00)
    at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/src/quick/items/qquickitem.cpp:9019
#47 0x00007f6022b8b168 in QApplicationPrivate::notify_helper
    (this=<optimized out>, receiver=0x27a7d60, e=0x7ffda1045d00)
    at
/usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/widgets/kernel/qapplication.cpp:3287
#48 0x00007f6021595b18 in QCoreApplication::notifyInternal2
    (receiver=0x27a7d60, event=0x7ffda1045d00)
    at
/usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/kernel/qcoreapplication.cpp:1134
#49 0x00007f6021595d7d in QCoreApplication::sendEvent
    (receiver=<optimized out>, event=<optimized out>)
    at
/usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/kernel/qcoreapplication.cpp:1575
#50 0x00007f6024ddbeb8 in
QQuickDeliveryAgentPrivate::deliverMatchingPointsToItem
    (this=this@entry=0x23ff540, item=item@entry=0x27a7d60,
isGrabber=isGrabber@entry=true, pointerEvent=pointerEvent@entry=0x7ffda1045d00,
handlersOnly=handlersOnly@entry=false)
    at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/src/quick/util/qquickdeliveryagent.cpp:2322
#51 0x00007f6024ddceda in QQuickDeliveryAgentPrivate::deliverUpdatedPoints
    (this=this@entry=0x23ff540, event=event@entry=0x7ffda1045d00)
    at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/src/quick/util/qquickdeliveryagent.cpp:2107
#52 0x00007f6024dddff3 in QQuickDeliveryAgentPrivate::deliverPointerEvent
    (this=this@entry=0x23ff540, event=event@entry=0x7ffda1045d00)
    at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/src/quick/util/qquickdeliveryagent.cpp:1947
#53 0x00007f6024ddf33b in QQuickDeliveryAgentPrivate::handleMouseEvent
    (this=this@entry=0x23ff540, event=event@entry=0x7ffda1045d00)
    at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/src/quick/util/qquickdeliveryagent.cpp:1701
#54 0x00007f6024de0e33 in QQuickDeliveryAgent::event (this=<optimized out>,
ev=0x7ffda1045d00)
    at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/src/quick/util/qquickdeliveryagent.cpp:746
#55 0x00007f6024cb8c7d in QQuickWindow::event (this=0x23d6250, event=<optimized
out>)
    at
/usr/src/debug/qt6-qtdeclarative-6.7.1-2.fc40.x86_64/src/quick/items/qquickwindow.cpp:1548
#56 0x00007f6022b8b168 in QApplicationPrivate::notify_helper
    (this=<optimized out>, receiver=0x23d6250, e=0x7ffda1045d00)
    at
/usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/widgets/kernel/qapplication.cpp:3287
#57 0x00007f6021595b18 in QCoreApplication::notifyInternal2
    (receiver=0x23d6250, event=0x7ffda1045d00)
    at
/usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/kernel/qcoreapplication.cpp:1134
#58 0x00007f6021595d8d in QCoreApplication::sendSpontaneousEvent
    (receiver=<optimized out>, event=<optimized out>)
    at
/usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/kernel/qcoreapplication.cpp:1589
#59 0x00007f6021fe59ab in QGuiApplicationPrivate::processMouseEvent
(e=0x7f5fd8b5e350)
    at
/usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/gui/kernel/qguiapplication.cpp:2327
#60 0x00007f602204952c in QWindowSystemInterface::sendWindowSystemEvents
(flags=...)
    at
/usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/gui/kernel/qwindowsysteminterface.cpp:1114
#61 0x00007f6022554e74 in userEventSourceDispatch (source=<optimized out>)
    at
/usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/gui/platform/unix/qeventdispatcher_glib.cpp:38
#62 0x00007f601eb0f6ac in g_main_dispatch (context=0x7f6008000f00) at
../glib/gmain.c:3344
#63 g_main_context_dispatch_unlocked (context=0x7f6008000f00) at
../glib/gmain.c:4152
#64 0x00007f601eb70708 in g_main_context_iterate_unlocked.isra.0
    (context=context@entry=0x7f6008000f00, block=block@entry=1,
dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4217
#65 0x00007f601eb10b23 in g_main_context_iteration (context=0x7f6008000f00,
may_block=1)
    at ../glib/gmain.c:4282
#66 0x00007f602187cb53 in QEventDispatcherGlib::processEvents (this=0x2091a30,
flags=...)
    at
/usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/kernel/qeventdispatcher_glib.cpp:394
#67 0x00007f60215a2713 in QEventLoop::exec (this=this@entry=0x7ffda1046130,
flags=..., 
    flags@entry=...) at
/usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/global/qflags.h:34
#68 0x00007f602159e69c in QCoreApplication::exec ()
    at
/usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/corelib/global/qflags.h:74
#69 0x00007f6021fd53dd in QGuiApplication::exec ()
    at
/usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/gui/kernel/qguiapplication.cpp:1926
#70 0x00007f6022b8b0d9 in QApplication::exec ()
    at
/usr/src/debug/qt6-qtbase-6.7.1-2.fc40.x86_64/src/widgets/kernel/qapplication.cpp:2555
#71 0x0000000000439596 in main (argc=<optimized out>, argv=<optimized out>)
    at /home/nate/kde/src/neochat/src/main.cpp:310


EXPECTED RESULT
No crash


ADDITIONAL INFORMATION
`git bisect` says this is the commit that caused the issue:

efb72652ce9596c59298563bf0d86b65f6cfc7bc is the first bad commit
commit efb72652ce9596c59298563bf0d86b65f6cfc7bc (HEAD)
Author: James Graham <james.h.gra...@protonmail.com>
Date:   Mon May 27 14:54:42 2024 +0000

    Use MessageContentModel for replies

    This allows code and other components to be displayed nicely.

 src/enums/messagecomponenttype.h              |   2 +-
 src/models/messagecontentmodel.cpp            | 242
+++++++++++++++++++++++++++++-------------------
 src/models/messagecontentmodel.h              |  18 +++-
 src/models/messageeventmodel.cpp              |   4 +-
 src/models/searchmodel.cpp                    |   4 +-
 src/neochatroom.cpp                           |  55 ++++++++++-
 src/neochatroom.h                             |  29 ++++--
 src/timeline/CMakeLists.txt                   |   2 +
 src/timeline/CodeComponent.qml                |   4 +-
 src/timeline/LinkPreviewLoadComponent.qml     |  91 ++++++++++++++++++
 src/timeline/LoadComponent.qml                |  81 +++-------------
 src/timeline/MessageComponentChooser.qml      |  22 ++---
 src/timeline/ReplyComponent.qml               | 107 ++-------------------
 src/timeline/ReplyMessageComponentChooser.qml | 170
++++++++++++++++++++++++++++++++++
 14 files changed, 533 insertions(+), 298 deletions(-)
 create mode 100644 src/timeline/LinkPreviewLoadComponent.qml
 create mode 100644 src/timeline/ReplyMessageComponentChooser.qml

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to