Skip to content

core/log: Fix nullptr crash in ThreadLogging #180

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ItzDerock
Copy link

At some point, quickshell on my system crashed and wouldn't start again. After building a debug version, I noticed the crash was due to a nullptr deref, fixed in this PR.

[New Thread 0x7fffef7ff6c0 (LWP 295335)]
  INFO: Launching config: "/nix/store/wlq543267h79qwdig63cg43kykkib45f-hv2iqc4592h80mdb8b90prr3qzcwcdi1-source/shell.qml"
  INFO: Shell ID: "bc1465e6ad38688c799dcd58bf3be599" Path ID "bc1465e6ad38688c799dcd58bf3be599"
  INFO: Saving logs to "/run/user/1000/quickshell/by-id/ovb60byx0t/log.qslog"
Detailed logger failed to write. Ending detailed logs.

Thread 2 "QThread" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffef7ff6c0 (LWP 295335)]
0x00005555556c6cec in qs::log::ThreadLogging::onMessage (this=0x7fffeea19140, msg=..., showInSparse=<optimized out>) at /home/derock/Documents/Code/quickshell/src/core/logging.cpp:466
466     this->detailedFile->close();
(gdb) bt
#0  0x00005555556c6cec in qs::log::ThreadLogging::onMessage (this=0x7fffeea19140, msg=..., showInSparse=<optimized out>) at /home/derock/Documents/Code/quickshell/src/core/logging.cpp:466
#1  0x00007ffff4c0dd97 in QObject::event(QEvent*) () from /nix/store/8qs879yx84gng0yljdybwi4fbbgg3dyy-qtbase-6.9.0/lib/libQt6Core.so.6
#2  0x00007ffff4bb262d in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /nix/store/8qs879yx84gng0yljdybwi4fbbgg3dyy-qtbase-6.9.0/lib/libQt6Core.so.6
#3  0x00007ffff4bb63e4 in QCoreApplicationPrivate::sendPostedEvents(QObject*, int, QThreadData*) () from /nix/store/8qs879yx84gng0yljdybwi4fbbgg3dyy-qtbase-6.9.0/lib/libQt6Core.so.6
#4  0x00007ffff4ec42c7 in postEventSourceDispatch(_GSource*, int (*)(void*), void*) () from /nix/store/8qs879yx84gng0yljdybwi4fbbgg3dyy-qtbase-6.9.0/lib/libQt6Core.so.6
#5  0x00007ffff450181e in g_main_context_dispatch_unlocked () from /nix/store/bkpj51fz88rbyjd60i6lrp0xdax1b24g-glib-2.84.1/lib/libglib-2.0.so.0
#6  0x00007ffff4503a90 in g_main_context_iterate_unlocked.isra () from /nix/store/bkpj51fz88rbyjd60i6lrp0xdax1b24g-glib-2.84.1/lib/libglib-2.0.so.0
#7  0x00007ffff45042bc in g_main_context_iteration () from /nix/store/bkpj51fz88rbyjd60i6lrp0xdax1b24g-glib-2.84.1/lib/libglib-2.0.so.0
#8  0x00007ffff4ec39a3 in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /nix/store/8qs879yx84gng0yljdybwi4fbbgg3dyy-qtbase-6.9.0/lib/libQt6Core.so.6
#9  0x00007ffff4bc0beb in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /nix/store/8qs879yx84gng0yljdybwi4fbbgg3dyy-qtbase-6.9.0/lib/libQt6Core.so.6
#10 0x00007ffff4ce0710 in QThread::exec() () from /nix/store/8qs879yx84gng0yljdybwi4fbbgg3dyy-qtbase-6.9.0/lib/libQt6Core.so.6
#11 0x00007ffff4d823b2 in QThreadPrivate::start(void*) () from /nix/store/8qs879yx84gng0yljdybwi4fbbgg3dyy-qtbase-6.9.0/lib/libQt6Core.so.6
#12 0x00007ffff4297e63 in start_thread () from /nix/store/cg9s562sa33k78m63njfn1rw47dp9z0i-glibc-2.40-66/lib/libc.so.6
#13 0x00007ffff431bdbc in __clone3 () from /nix/store/cg9s562sa33k78m63njfn1rw47dp9z0i-glibc-2.40-66/lib/libc.so.6
(gdb) p this->detailedFile
$1 = (QFile *) 0x0

@ItzDerock
Copy link
Author

looking further, i think the cause is my /run/user/1000 being full, since that's where quickshell stores logs:

tmpfs           3.1G  3.1G     0 100% /run/user/1000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant