Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

qTox segfaults when logging out after reconnect #4201

Closed
zetok opened this issue Feb 24, 2017 · 3 comments
Closed

qTox segfaults when logging out after reconnect #4201

zetok opened this issue Feb 24, 2017 · 3 comments
Labels
C-bug The issue contains a bug report C-crash The issue contains a crash report

Comments

@zetok
Copy link
Contributor

zetok commented Feb 24, 2017

Brief Description

OS: Gentoo Linux amd64
qTox version: v1.8.1-63-g2248deb
Commit hash: 2248deb
toxcore: 0.1.5
Qt: 5.6.2

Reproducible: Always

Steps to reproduce
  1. multiple windows mode
  2. open settings Advanced tab
  3. open Profile page
  4. click on Reconnect in settings tab
  5. click on Logout on Profile page
Observed Behavior

qTox segfaults

Expected Behavior

qTox should log out profile

Additional Info

backtrace:

[14:59:00.684 UTC] persistence/settings.cpp:488 : Debug: "Saving global settings at /home/zetok/.config/tox/qtox.ini"
[14:59:00.736 UTC] widget/systemtrayicon.cpp:99 : Debug: Deleting SystemTrayIcon
[14:59:00.806 UTC] persistence/settings.cpp:488 : Debug: "Saving global settings at /home/zetok/.config/tox/qtox.ini"
[14:59:00.928 UTC] persistence/settings.cpp:488 : Debug: "Saving global settings at /home/zetok/.config/tox/qtox.ini"
[14:59:01.039 UTC] persistence/settings.cpp:488 : Debug: "Saving global settings at /home/zetok/.config/tox/qtox.ini"
[14:59:01.150 UTC] persistence/settings.cpp:488 : Debug: "Saving global settings at /home/zetok/.config/tox/qtox.ini"
[14:59:01.250 UTC] persistence/settings.cpp:488 : Debug: "Saving global settings at /home/zetok/.config/tox/qtox.ini"
[14:59:01.350 UTC] persistence/settings.cpp:488 : Debug: "Saving global settings at /home/zetok/.config/tox/qtox.ini"
[14:59:01.439 UTC] persistence/profile.cpp:385 : Debug: Saving tox save to  "/home/zetok/.config/tox/_3.tox"
[14:59:01.439 UTC] core/core.cpp:421 : Debug: "Connecting to biribiri.org:33445 (nurupo)"
[14:59:01.507 UTC] persistence/profile.cpp:385 : Debug: Saving tox save to  "/home/zetok/.config/tox/_3.tox"
[14:59:01.564 UTC] persistence/profile.cpp:385 : Debug: Saving tox save to  "/home/zetok/.config/tox/_3.tox"
[14:59:01.632 UTC] core/core.cpp:421 : Debug: "Connecting to toxnode.nek0.net:33445 (Phsm)"
[Thread 0x7fffbaafd700 (LWP 687) exited]
[Thread 0x7fffbb5b6700 (LWP 9220) exited]
[14:59:01.934 UTC] persistence/settings.cpp:650 : Debug: Saving personal settings at  "/home/zetok/.config/tox/_3.ini"
[Thread 0x7fffba280700 (LWP 688) exited]

Program received signal SIGSEGV, Segmentation fault.
QMutex::lock (this=this@entry=0x5555592f66b0) at thread/qmutex.cpp:221
221	thread/qmutex.cpp: No such file or directory.
(gdb) bt
#0  QMutex::lock (this=this@entry=0x5555592f66b0) at thread/qmutex.cpp:221
#1  0x00007ffff2c8824d in QMutexLocker::QMutexLocker (m=0x5555592f66b0, 
    this=<synthetic pointer>) at thread/qmutex.h:128
#2  QThread::isRunning (this=<optimized out>) at thread/qthread.cpp:440
#3  0x0000555555723858 in Profile::~Profile() ()
#4  0x00005555557239e0 in Profile::~Profile() ()
#5  0x000055555571554b in Nexus::showLogin() ()
#6  0x00005555557adaa9 in Nexus::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) ()
#7  0x00007ffff2e902da in QObject::event (this=0x5555564c6f90, 
    e=<optimized out>) at kernel/qobject.cpp:1256
#8  0x00007ffff771e5c4 in QApplicationPrivate::notify_helper (
    this=<optimized out>, receiver=0x5555564c6f90, e=0x55555ab0af10)
    at kernel/qapplication.cpp:3804
#9  0x00007ffff77234be in QApplication::notify (this=0x7fffffffdb50, 
    receiver=0x5555564c6f90, e=0x55555ab0af10)
    at kernel/qapplication.cpp:3561
#10 0x00007ffff2e5f618 in QCoreApplication::notifyInternal2 (
    receiver=0x5555564c6f90, event=event@entry=0x55555ab0af10)
    at kernel/qcoreapplication.cpp:1015
#11 0x00007ffff2e626a4 in QCoreApplication::sendEvent (
    event=0x55555ab0af10, receiver=<optimized out>)
    at kernel/qcoreapplication.h:225
#12 QCoreApplicationPrivate::sendPostedEvents (
    receiver=receiver@entry=0x0, event_type=event_type@entry=0, 
    data=0x55555644c620) at kernel/qcoreapplication.cpp:1650
#13 0x00007ffff2e62ccc in QCoreApplication::sendPostedEvents (
    receiver=receiver@entry=0x0, event_type=event_type@entry=0)
    at kernel/qcoreapplication.cpp:1508
#14 0x00007ffff2eb8842 in postEventSourceDispatch (s=0x555556491160)
    at kernel/qeventdispatcher_glib.cpp:270
#15 0x00007fffeb232343 in g_main_dispatch (context=0x7fffdc0016f0)
    at /var/tmp/portage/dev-libs/glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3154
#16 g_main_context_dispatch (context=context@entry=0x7fffdc0016f0)
    at /var/tmp/portage/dev-libs/glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3769
#17 0x00007fffeb232630 in g_main_context_iterate (
    context=context@entry=0x7fffdc0016f0, block=block@entry=0, 
    dispatch=dispatch@entry=1, self=<optimized out>)
    at /var/tmp/portage/dev-libs/glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3840
#18 0x00007fffeb232702 in g_main_context_iteration (
    context=0x7fffdc0016f0, may_block=0)
    at /var/tmp/portage/dev-libs/glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3901
#19 0x00007ffff2eb8c3a in QEventDispatcherGlib::processEvents (this=
    0x555556494160, flags=...) at kernel/qeventdispatcher_glib.cpp:417
#20 0x0000555555723848 in Profile::~Profile() ()
#21 0x00005555557239e0 in Profile::~Profile() ()
#22 0x000055555571554b in Nexus::showLogin() ()
#23 0x00005555557adaa9 in Nexus::qt_static_metacall(QObject*, QMetaObject::Call, int, void**) ()
---Type <return> to continue, or q <return> to quit---
#24 0x00007ffff2e902da in QObject::event (this=0x5555564c6f90, 
    e=<optimized out>) at kernel/qobject.cpp:1256
#25 0x00007ffff771e5c4 in QApplicationPrivate::notify_helper (
    this=<optimized out>, receiver=0x5555564c6f90, e=0x55555acc10c0)
    at kernel/qapplication.cpp:3804
#26 0x00007ffff77234be in QApplication::notify (this=0x7fffffffdb50, 
    receiver=0x5555564c6f90, e=0x55555acc10c0)
    at kernel/qapplication.cpp:3561
#27 0x00007ffff2e5f618 in QCoreApplication::notifyInternal2 (
    receiver=0x5555564c6f90, event=event@entry=0x55555acc10c0)
    at kernel/qcoreapplication.cpp:1015
#28 0x00007ffff2e626a4 in QCoreApplication::sendEvent (
    event=0x55555acc10c0, receiver=<optimized out>)
    at kernel/qcoreapplication.h:225
#29 QCoreApplicationPrivate::sendPostedEvents (
    receiver=receiver@entry=0x0, event_type=event_type@entry=0, 
    data=0x55555644c620) at kernel/qcoreapplication.cpp:1650
#30 0x00007ffff2e62ccc in QCoreApplication::sendPostedEvents (
    receiver=receiver@entry=0x0, event_type=event_type@entry=0)
    at kernel/qcoreapplication.cpp:1508
#31 0x00007ffff2eb8842 in postEventSourceDispatch (s=0x555556491160)
    at kernel/qeventdispatcher_glib.cpp:270
#32 0x00007fffeb232343 in g_main_dispatch (context=0x7fffdc0016f0)
    at /var/tmp/portage/dev-libs/glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3154
#33 g_main_context_dispatch (context=context@entry=0x7fffdc0016f0)
    at /var/tmp/portage/dev-libs/glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3769
#34 0x00007fffeb232630 in g_main_context_iterate (
    context=context@entry=0x7fffdc0016f0, block=block@entry=1, 
    dispatch=dispatch@entry=1, self=<optimized out>)
    at /var/tmp/portage/dev-libs/glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3840
#35 0x00007fffeb232702 in g_main_context_iteration (
    context=0x7fffdc0016f0, may_block=1)
    at /var/tmp/portage/dev-libs/glib-2.48.2/work/glib-2.48.2/glib/gmain.c:3901
#36 0x00007ffff2eb8bde in QEventDispatcherGlib::processEvents (
    this=0x555556494160, flags=...) at kernel/qeventdispatcher_glib.cpp:417
#37 0x00007ffff2e5d67b in QEventLoop::exec (this=this@entry=
    0x7fffffffda30, flags=..., flags@entry=...)
    at kernel/qeventloop.cpp:206
#38 0x00007ffff2e6696e in QCoreApplication::exec ()
    at kernel/qcoreapplication.cpp:1285
#39 0x000055555570b218 in main ()
@zetok zetok added C-bug The issue contains a bug report C-crash The issue contains a crash report up for grabs labels Feb 24, 2017
@zetok
Copy link
Contributor Author

zetok commented Feb 26, 2017

Note: I was not able to reproduce the crash on a profile without any contacts. On the other hand, it's ~easily reproducible with a big contact list (>40).

When trying to reproduce, one should keep clicking on Logout button until the crash.

@anthonybilinski
Copy link
Member

the path is:
void ProfileForm::onLogoutClicked()
calls nexus.showLoginLater();
async invokes showLogin
Nexus::showLogin deletes profile

with multiple clicks of logout, multiple invocations of showLogin get queued and they get executed in parallel. Then the second thread calls delete on profile while the first thread is still destructing profile, so it starts checking coreThread->isRunning() while the first is calling delete coreThread.

@anthonybilinski
Copy link
Member

"isEnabled() indicates whether the button can be pressed by the user.

Note: As opposed to other widgets, buttons derived from QAbstractButton accept mouse and context menu events when disabled."

So even though we're calling GUI::setEnabled(false); at the start of Nexus::showLoginLater, it still accepts more clicks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
C-bug The issue contains a bug report C-crash The issue contains a crash report
Projects
None yet
Development

No branches or pull requests

2 participants