Bug 466330 - NeoChat Crashes at launch
Summary: NeoChat Crashes at launch
Status: RESOLVED FIXED
Alias: None
Product: NeoChat
Classification: Applications
Component: General (other bugs)
Version First Reported In: 23.01.0
Platform: Neon Linux
: NOR crash
Target Milestone: ---
Assignee: Tobias Fella
URL:
Keywords: drkonqi
Depends on:
Blocks:
 
Reported: 2023-02-24 02:21 UTC by Aranjedeath
Modified: 2023-10-06 21:39 UTC (History)
3 users (show)

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


Attachments
New crash information added by DrKonqi (11.76 KB, text/plain)
2023-10-06 21:39 UTC, Petrov Egor
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Aranjedeath 2023-02-24 02:21:47 UTC
Application: neochat (23.01)

Qt Version: 5.15.8
Frameworks Version: 5.103.0
Operating System: Linux 5.19.0-32-generic x86_64
Windowing System: X11
Distribution: KDE neon 5.27
DrKonqi: 5.27.1 [KCrashBackend]

-- Information about the crash:
I use KDE NEON, and they released the 5.27.1 update. After that update (Tuesday this week), neochat reliably crashes on launch. Another person on IRC confirmed this behavior.

[17:57:30] <rdr> crashed on very first message recieved

previous to this update, kde plasma 5.27.0, Neochat launched without issue.

The crash can be reproduced every time.

-- Backtrace:
Application: NeoChat (neochat), signal: Segmentation fault

[KCrash Handler]
#4  QString::QString (other=..., this=<optimized out>, this=<optimized out>, other=...) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qstring.h:1093
#5  operator() (e=..., __closure=<optimized out>) at ./src/neochatroom.cpp:470
#6  Quotient::switchOnType<Quotient::RoomEvent, NeoChatRoom::eventToString(const Quotient::RoomEvent&, Qt::TextFormat, bool) const::<lambda(const Quotient::RoomMessageEvent&)>, NeoChatRoom::eventToString(const Quotient::RoomEvent&, Qt::TextFormat, bool) const::<lambda(const Quotient::StickerEvent&)>, NeoChatRoom::eventToString(const Quotient::RoomEvent&, Qt::TextFormat, bool) const::<lambda(const Quotient::RoomMemberEvent&)>, NeoChatRoom::eventToString(const Quotient::RoomEvent&, Qt::TextFormat, bool) const::<lambda(const Quotient::RoomCanonicalAliasEvent&)>, NeoChatRoom::eventToString(const Quotient::RoomEvent&, Qt::TextFormat, bool) const::<lambda(const Quotient::RoomNameEvent&)>, NeoChatRoom::eventToString(const Quotient::RoomEvent&, Qt::TextFormat, bool) const::<lambda(const Quotient::RoomTopicEvent&)>, NeoChatRoom::eventToString(const Quotient::RoomEvent&, Qt::TextFormat, bool) const::<lambda(const Quotient::RoomAvatarEvent&)>, NeoChatRoom::eventToString(const Quotient::RoomEvent&, Qt::TextFormat, bool) const::<lambda(const Quotient::EncryptionEvent&)>, NeoChatRoom::eventToString(const Quotient::RoomEvent&, Qt::TextFormat, bool) const::<lambda(const Quotient::RoomCreateEvent&)>, NeoChatRoom::eventToString(const Quotient::RoomEvent&, Qt::TextFormat, bool) const::<lambda(const Quotient::RoomPowerLevelsEvent&)>, NeoChatRoom::eventToString(const Quotient::RoomEvent&, Qt::TextFormat, bool) const::<lambda(const StateEventBase&)>, NeoChatRoom::eventToString(const Quotient::RoomEvent&, Qt::TextFormat, bool) const::<lambda(const Quotient::PollStartEvent&)>, QString> (fn1=..., event=...) at /usr/include/libquotient/Quotient/events/event.h:620
#7  NeoChatRoom::eventToString(Quotient::RoomEvent const&, Qt::TextFormat, bool) const [clone .constprop.0] (this=0x5582f582fdd0, evt=..., format=Qt::RichText, removeReply=true) at ./src/neochatroom.cpp:658
#8  0x00005582f102a928 in MessageEventModel::data (this=0x5582fa089480, idx=..., role=0) at ./src/models/messageeventmodel.cpp:476
#9  0x00007f32ee65cb4d in QAbstractItemModel::itemData(QModelIndex const&) const () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#10 0x00005582f102d030 in MessageEventModel::data (this=0x5582fa089480, idx=..., role=<optimized out>) at ./src/models/messageeventmodel.cpp:757
#11 0x00007f32ee685e79 in QSortFilterProxyModel::data(QModelIndex const&, int) const () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#12 0x00005582f1068248 in CollapseStateProxyModel::data (this=0x5582f98ff6e0, index=..., role=276) at ./src/models/collapsestateproxymodel.cpp:28
#13 0x00007f32ef95b4f7 in ?? () from /lib/x86_64-linux-gnu/libQt5QmlModels.so.5
#14 0x00007f32f05a79f6 in ?? () from /lib/x86_64-linux-gnu/libQt5Qml.so.5
#15 0x00007f32f05a8592 in QV4::QObjectWrapper::getQmlProperty(QV4::ExecutionEngine*, QQmlContextData*, QObject*, QV4::String*, QV4::QObjectWrapper::RevisionMode, bool*, QQmlPropertyData**) () from /lib/x86_64-linux-gnu/libQt5Qml.so.5
#16 0x00007f32f0583b05 in QV4::QQmlContextWrapper::lookupInParentContextHierarchy(QV4::Lookup*, QV4::ExecutionEngine*, QV4::Value*) () from /lib/x86_64-linux-gnu/libQt5Qml.so.5
#17 0x00007f32f05c754c in ?? () from /lib/x86_64-linux-gnu/libQt5Qml.so.5
#18 0x00007f32f05ccb9f in ?? () from /lib/x86_64-linux-gnu/libQt5Qml.so.5
#19 0x00007f32f055eaee in QV4::Function::call(QV4::Value const*, QV4::Value const*, int, QV4::ExecutionContext const*) () from /lib/x86_64-linux-gnu/libQt5Qml.so.5
#20 0x00007f32f06eb3a5 in QQmlJavaScriptExpression::evaluate(QV4::CallData*, bool*) () from /lib/x86_64-linux-gnu/libQt5Qml.so.5
#21 0x00007f32f06f16a8 in QQmlBinding::evaluate(bool*) () from /lib/x86_64-linux-gnu/libQt5Qml.so.5
#22 0x00007f32f06f59db in ?? () from /lib/x86_64-linux-gnu/libQt5Qml.so.5
#23 0x00007f32f06f3664 in QQmlBinding::update(QFlags<QQmlPropertyData::WriteFlag>) () from /lib/x86_64-linux-gnu/libQt5Qml.so.5
#24 0x00007f32f0700fca in QQmlObjectCreator::finalize(QQmlInstantiationInterrupt&) () from /lib/x86_64-linux-gnu/libQt5Qml.so.5
#25 0x00007f32f0696235 in QQmlIncubatorPrivate::incubate(QQmlInstantiationInterrupt&) () from /lib/x86_64-linux-gnu/libQt5Qml.so.5
#26 0x00007f32f069684d in QQmlEnginePrivate::incubate(QQmlIncubator&, QQmlContextData*) () from /lib/x86_64-linux-gnu/libQt5Qml.so.5
#27 0x00007f32ef96f363 in ?? () from /lib/x86_64-linux-gnu/libQt5QmlModels.so.5
#28 0x00007f32f0d30375 in QQuickItemViewPrivate::createItem (this=this@entry=0x5582fa073d80, modelIndex=1, incubationMode=incubationMode@entry=QQmlIncubator::Synchronous) at items/qquickitemview.cpp:2351
#29 0x00007f32f0d40f79 in QQuickListViewPrivate::applyInsertionChange (this=0x5582fa073d80, change=..., insertResult=<optimized out>, addedItems=<optimized out>, movingIntoView=<optimized out>) at items/qquicklistview.cpp:3711
#30 0x00007f32f0d30f5d in QQuickItemViewPrivate::applyModelChanges (this=this@entry=0x5582fa073d80, totalInsertionResult=totalInsertionResult@entry=0x7ffd208ed880, totalRemovalResult=totalRemovalResult@entry=0x7ffd208ed8b0) at items/qquickitemview.cpp:2061
#31 0x00007f32f0d3184a in QQuickItemViewPrivate::layout (this=0x5582fa073d80) at items/qquickitemview.cpp:1895
#32 0x00007f32f0c7f28d in QQuickWindowPrivate::polishItems (this=0x5582f3046cc0) at items/qquickwindow.cpp:393
#33 0x00007f32f0c1db65 in QSGThreadedRenderLoop::polishAndSync (this=0x5582f3047a90, w=0x5582f3830df0, inExpose=<optimized out>) at scenegraph/qsgthreadedrenderloop.cpp:1576
#34 0x00007f32f0c8cacf in QQuickWindow::event (this=0x5582f2f15c20, e=0x7ffd208edc20) at items/qquickwindow.cpp:1863
#35 0x00007f32ef36c793 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#36 0x00007f32ee6bc07a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#37 0x00007f32eeb31894 in QPlatformWindow::windowEvent(QEvent*) () from /lib/x86_64-linux-gnu/libQt5Gui.so.5
#38 0x00007f32ef3739ba in QApplication::notify(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#39 0x00007f32ee6bc07a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#40 0x00007f32ee714e0b in QTimerInfoList::activateTimers() () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#41 0x00007f32ee715754 in ?? () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#42 0x00007f32edec6d3b in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#43 0x00007f32edf1b6c8 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#44 0x00007f32edec43e3 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#45 0x00007f32ee715ad8 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#46 0x00007f32ee6ba99b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#47 0x00007f32ee6c2f34 in QCoreApplication::exec() () from /lib/x86_64-linux-gnu/libQt5Core.so.5
#48 0x00005582f0f29579 in main (argc=<optimized out>, argv=<optimized out>) at ./src/main.cpp:332
[Inferior 1 (process 49093) detached]

Reported using DrKonqi
Comment 1 Tobias Fella 2023-03-05 22:51:09 UTC
This will go away with https://invent.kde.org/network/neochat/-/merge_requests/808
Comment 2 James Graham 2023-03-24 18:16:11 UTC
Git commit da1c664f941b96d650e64240253ba09f46ed291a by James Graham.
Committed on 13/03/2023 at 18:18.
Pushed by nvrwhere into branch 'release/23.04'.

Cherrypick Improve Text Handling to 23.04

Improve the handling of text both when sending and receiving.

The main feature is to fix the linked bug (and a host of others that are unreported but similar) which is caused by the fact that we don't properly clean html. This mr does that as per the matrix spec https://spec.matrix.org/v1.5/client-server-api/#mroommessage-msgtypes. So any disallowed tags or attributes are removed and it does the special handling for certain attributes.

Additionally the functions are also designed to cover any other text formatting required, particularly fro received strings.

The receive side is covered by 2 functions `handleRecieveRichText` and `handleRecievePlainText`. The rich/plain in the function name refers to the output type not the input type (both can take plain and rich input), so `handleRecieveRichText` is called to get a string suitable to go in a rich text control and `handleRecievePlainText` for a plain control.

The functions also handle the following some of which was previously handled by `eventToString` in `NeoChatRoom`:
- Strip and reply from the string
- Format any user mentions
- Linkify links in plain strings
- Handle mxc urls in rich text (uses the new `room->makeMediaUrl` functionality from libQuotient)
- `handleRecievePlainText` also deals with markup making `NeoChatRoom->subtitle` redundant

There is also an extensive test suite which defines the behaviour and the best way to review this is probably to look at the tests and decide whether you agree with the expected output given the inputs and/or if there is any missing behaviour.

The final aim especially with the test suite is to give us a framework to make further updates in the future easier and hopefully prevent a new feature breaking old behaviour with the tests.
Related: bug 463932, bug 466930


(cherry picked from commit f6ba4f2ecd470487f1133a570459086059750775)

M  +6    -0    autotests/CMakeLists.txt
M  +1    -1    autotests/neochatroomtest.cpp
A  +482  -0    autotests/texthandlertest.cpp     [License: GPL(3+eV) GPL(v3.0) GPL(v2.0)]
M  +1    -1    src/CMakeLists.txt
M  +5    -17   src/actionshandler.cpp
M  +0    -2    src/actionshandler.h
M  +0    -1    src/models/messageeventmodel.cpp
M  +1    -1    src/models/roomlistmodel.cpp
M  +28   -76   src/neochatroom.cpp
M  +2    -8    src/neochatroom.h
M  +4    -2    src/notificationsmanager.cpp
M  +2    -19   src/qml/Component/Timeline/RichLabel.qml
A  +378  -0    src/texthandler.cpp     [License: GPL(3+eV) GPL(v3.0) GPL(v2.0)]
A  +131  -0    src/texthandler.h     [License: GPL(3+eV) GPL(v3.0) GPL(v2.0)]
D  +0    -4    src/utils.cpp
D  +0    -16   src/utils.h

https://invent.kde.org/network/neochat/commit/da1c664f941b96d650e64240253ba09f46ed291a
Comment 3 James Graham 2023-03-24 18:16:36 UTC
Git commit f6ba4f2ecd470487f1133a570459086059750775 by James Graham.
Committed on 13/03/2023 at 17:28.
Pushed by nvrwhere into branch 'master'.

Improve Text Handling

Improve the handling of text both when sending and receiving.

The main feature is to fix the linked bug (and a host of others that are unreported but similar) which is caused by the fact that we don't properly clean html. This mr does that as per the matrix spec https://spec.matrix.org/v1.5/client-server-api/#mroommessage-msgtypes. So any disallowed tags or attributes are removed and it does the special handling for certain attributes.

Additionally the functions are also designed to cover any other text formatting required, particularly fro received strings.

The receive side is covered by 2 functions `handleRecieveRichText` and `handleRecievePlainText`. The rich/plain in the function name refers to the output type not the input type (both can take plain and rich input), so `handleRecieveRichText` is called to get a string suitable to go in a rich text control and `handleRecievePlainText` for a plain control.

The functions also handle the following some of which was previously handled by `eventToString` in `NeoChatRoom`:
- Strip and reply from the string
- Format any user mentions
- Linkify links in plain strings
- Handle mxc urls in rich text (uses the new `room->makeMediaUrl` functionality from libQuotient)
- `handleRecievePlainText` also deals with markup making `NeoChatRoom->subtitle` redundant

There is also an extensive test suite which defines the behaviour and the best way to review this is probably to look at the tests and decide whether you agree with the expected output given the inputs and/or if there is any missing behaviour.

The final aim especially with the test suite is to give us a framework to make further updates in the future easier and hopefully prevent a new feature breaking old behaviour with the tests.
Related: bug 463932, bug 466930

M  +6    -0    autotests/CMakeLists.txt
M  +1    -1    autotests/neochatroomtest.cpp
A  +482  -0    autotests/texthandlertest.cpp     [License: GPL(3+eV) GPL(v3.0) GPL(v2.0)]
M  +1    -1    src/CMakeLists.txt
M  +5    -17   src/actionshandler.cpp
M  +0    -2    src/actionshandler.h
M  +0    -1    src/models/messageeventmodel.cpp
M  +1    -1    src/models/roomlistmodel.cpp
M  +28   -76   src/neochatroom.cpp
M  +2    -8    src/neochatroom.h
M  +4    -2    src/notificationsmanager.cpp
M  +2    -19   src/qml/Component/Timeline/RichLabel.qml
A  +378  -0    src/texthandler.cpp     [License: GPL(3+eV) GPL(v3.0) GPL(v2.0)]
A  +131  -0    src/texthandler.h     [License: GPL(3+eV) GPL(v3.0) GPL(v2.0)]
D  +0    -4    src/utils.cpp
D  +0    -16   src/utils.h

https://invent.kde.org/network/neochat/commit/f6ba4f2ecd470487f1133a570459086059750775
Comment 4 Petrov Egor 2023-10-06 21:39:05 UTC
Created attachment 162130 [details]
New crash information added by DrKonqi

neochat (23.08.1) using Qt 5.15.10

Just installed NeoChat from main repo (openSUSE Tumbleweed), crashes just after launching.

Is there enough data?

-- Backtrace (Reduced):
#4  Quotient::RoomStateView::RoomStateView(Quotient::RoomStateView const&) (this=this@entry=0x7fff37ef1468) at /usr/src/debug/libQuotient-0.8.1.2/Quotient/roomstateview.h:24
#5  Quotient::Room::currentState() const (this=this@entry=0x0) at /usr/src/debug/libQuotient-0.8.1.2/Quotient/room.cpp:1574
#6  0x0000555b5af28939 in ImagePacksModel::reloadImages() (this=this@entry=0x555b5d4300f0) at /usr/src/debug/neochat-23.08.1/src/models/imagepacksmodel.cpp:105
#7  0x0000555b5af29b5d in ImagePacksModel::setRoom(NeoChatRoom*) (room=<optimized out>, this=0x555b5d4300f0) at /usr/src/debug/neochat-23.08.1/src/models/imagepacksmodel.cpp:73
#8  ImagePacksModel::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) (_o=_o@entry=0x555b5d4300f0, _c=_c@entry=QMetaObject::WriteProperty, _id=_id@entry=0, _a=_a@entry=0x7fff37ef1690) at /usr/src/debug/neochat-23.08.1/build/src/neochat_autogen/include/moc_imagepacksmodel.cpp:167