moonlight-qt icon indicating copy to clipboard operation
moonlight-qt copied to clipboard

Fix logger-based coredumps during early exits

Open FrogTheFrog opened this issue 11 months ago • 0 comments

On my linux laptop calling moonlight --help results in a crash/coredump after the help is printed.

It is caused by 00:00:00 - Qt Warning: QThreadStorage: entry 2 destroyed before end of thread 0x5555558b5c80 log entry that is being logged after atexit(SDL_Quit()); (I don't know if that's the only log).

The crash occurs here:

void logToLoggerStream(QString& message)
{
    // ... omitted

    // Strip session encryption keys and IVs from the logs
    message.replace(k_RikeyRegex, "&rikey=REDACTED");
    message.replace(k_RikeyIdRegex, "&rikeyid=REDACTED");

    // ... omitted
}

The regex backend/engine used by Qt for k_RikeyRegex is already cleaned up and causes SEGFAULT at best, in other cases the process just hangs for a minute or 2. Removing these message.replace(...) creates SEGFAULTs in other places.

This is my least invasive solution for suppressing the logging without refactoring global variables and thus preventing segfaults.

FrogTheFrog avatar Apr 27 '25 08:04 FrogTheFrog