Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash when closing a chat window immediately after sending a message #150

Closed
wfr opened this issue May 2, 2022 · 6 comments
Closed

Crash when closing a chat window immediately after sending a message #150

wfr opened this issue May 2, 2022 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@wfr
Copy link

wfr commented May 2, 2022

When the user closes a chat window immediately after sending a message, the GUI crashes.

Version: b0a274c07f0e8afd7b6727e3fe8428e1f9ad5249 (main)

Steps to reproduce:

  • Configure Ricochet to use multi-window mode
  • Open a chat window
  • Send a message
  • Close the window immediately
ASSERT: "row >= 0" in file /home/user/ricochet-refresh/src/libtego_ui/shims/ConversationModel.cpp, line 684
(gdb) bt
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737244727552) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=140737244727552) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=140737244727552, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x00007ffff491a476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007ffff49007f3 in __GI_abort () at ./stdlib/abort.c:79
#5  0x00007ffff4fd6ba3 in  () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007ffff4fd5ff0 in qt_assert_x(char const*, char const*, char const*, int) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#7  0x0000555555a87d7f in shims::ConversationModel::messageAcknowledged(unsigned int, bool) (this=0x604000254b90, messageId=3308863449, accepted=true)
    at /home/user/ricochet-refresh/src/libtego_ui/shims/ConversationModel.cpp:684
#8  0x0000555555a5e575 in operator()() const (__closure=0x602000075610) at /home/user/ricochet-refresh/src/libtego_ui/libtego_callbacks.cpp:442
#9  0x0000555555a66e76 in operator()((anonymous namespace)::run_once_task*) const (__closure=0x0, self=0x61100030a240) at /home/user/ricochet-refresh/src/libtego_ui/libtego_callbacks.cpp:64
#10 0x0000555555a66f19 in _FUN((anonymous namespace)::run_once_task*) () at /home/user/ricochet-refresh/src/libtego_ui/libtego_callbacks.cpp:61
#11 0x0000555555a5a821 in (anonymous namespace)::run_once_task::operator()() (this=0x61100030a240) at /home/user/ricochet-refresh/src/libtego_ui/libtego_callbacks.cpp:83
#12 0x0000555555a5abd3 in (anonymous namespace)::consume_tasks() () at /home/user/ricochet-refresh/src/libtego_ui/libtego_callbacks.cpp:109
#13 0x0000555555a6baf8 in QtPrivate::FunctorCall<QtPrivate::IndexesList<>, QtPrivate::List<>, void, void (*)()>::call(void (*&)(), void**)
    (f=@0x603000675b30: 0x555555a5a97e <(anonymous namespace)::consume_tasks()>, arg=0x7fffffffcee0) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:146
#14 0x0000555555a6ba2d in QtPrivate::Functor<void (*)(), 0>::call<QtPrivate::List<>, void>(void (*&)(), void*, void**)
    (f=@0x603000675b30: 0x555555a5a97e <(anonymous namespace)::consume_tasks()>, arg=0x7fffffffcee0) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:256
#15 0x0000555555a6b9f8 in QtPrivate::QFunctorSlotObject<void (*)(), 0, QtPrivate::List<>, void>::impl(int, QtPrivate::QSlotObjectBase*, QObject*, void**, bool*)
    (which=1, this_=0x603000675b20, r=0x0, a=0x7fffffffcee0, ret=0x0) at /usr/include/x86_64-linux-gnu/qt5/QtCore/qobjectdefs_impl.h:443
#16 0x00007ffff523b886 in  () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#17 0x00007ffff522d32f in QObject::event(QEvent*) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#18 0x00007ffff6c2a713 in QApplicationPrivate::notify_helper(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt5Widgets.so.5
#19 0x00007ffff51ffe2a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#20 0x00007ffff52583db in QTimerInfoList::activateTimers() () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#21 0x00007ffff5258cdc in  () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#22 0x00007ffff3f43d1b in g_main_context_dispatch () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#23 0x00007ffff3f986f8 in  () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#24 0x00007ffff3f413c3 in g_main_context_iteration () at /lib/x86_64-linux-gnu/libglib-2.0.so.0
#25 0x00007ffff52590a8 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#26 0x00007ffff51fe74b in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#27 0x00007ffff5206ce4 in QCoreApplication::exec() () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#28 0x0000555555751b44 in main(int, char**) (argc=1, argv=0x7fffffffdfb8) at /home/user/ricochet-refresh/src/ricochet-refresh/main.cpp:235
@wfr
Copy link
Author

wfr commented May 2, 2022

refresh-issue-150.mp4

@wfr
Copy link
Author

wfr commented May 2, 2022

ChatWindow.qml:

onClosed: {
    // If not also in combined window mode, clear chat history when closing
    if (!uiSettings.data.combinedChatWindow)
        chatPage.conversationModel.clear()
}

If the above is executed before the sent message is acknowledged, the following assertion is triggered:

ConversationModel.cpp:

void ConversationModel::messageAcknowledged(tego_message_id_t messageId, bool accepted)
{
    auto row = this->indexOfOutgoingMessage(messageId);
    Q_ASSERT(row >= 0);

wfr added a commit to wfr/ricochet-irc that referenced this issue May 2, 2022
When the ConversationModel is cleared after sending a message but before
the acknowledgement is received, Ricochet crashes.

issue blueprint-freespeech#150
wfr added a commit to wfr/ricochet-irc that referenced this issue May 2, 2022
When the ConversationModel is cleared after sending a message but before
the acknowledgement is received, Ricochet crashes.

issue blueprint-freespeech#150
@morganava
Copy link
Collaborator

morganava commented May 14, 2022

@wfr thanks for the patch, I'll review and likely merge w/ the next release.

btw: your ricochet-irc project is neat, though I do somewhat question to decision to go through the shims in libtego_ui rather than through the libtego C API directly ^^; ( there is still the hidden qt dependency behind that C API but you know vOv )

@morganava morganava self-assigned this May 14, 2022
@morganava morganava added the bug Something isn't working label May 14, 2022
@wfr
Copy link
Author

wfr commented May 14, 2022

btw: your ricochet-irc project is neat, though I do somewhat question to decision to go through the shims in libtego_ui rather than through the libtego C API directly ^^;

Thanks :) It was a good idea of yours to split Ricochet into libtego and the UI, and I concur, the irc fork should use libtego directly. It used to be based on the original Ricochet and the quickest way to forward-port it to R² was to plug into libtego_ui. I will work on it at some point.

( there is still the hidden qt dependency behind that C API but you know vOv )

libtego doesn't have many Qt GUI dependencies; it should be feasible to make it completely headless, e.g. by replacing QRegularExpressionValidator. Should we open a ticket for this endeavor?

@morganava
Copy link
Collaborator

I'd be happy to review/merge patches, but my current dev focus (beyond some current grant work) is on redoing the entire libtego backend (see https://github.com/blueprint-freespeech/gosling for the authentication part).

The next backend will be in Rust (with a C FFI) and will not be backwards compatible with the Ricochet-Refresh 3 series.

@morganava
Copy link
Collaborator

@wfr: filed #154

morganava pushed a commit that referenced this issue May 14, 2022
When the ConversationModel is cleared after sending a message but before
the acknowledgement is received, Ricochet crashes.

issue #150
morganava pushed a commit that referenced this issue Jun 24, 2022
When the ConversationModel is cleared after sending a message but before
the acknowledgement is received, Ricochet crashes.

issue #150
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants