Skip to content

Fix autosave thread compression TLS crash.#1544

Open
ModMaker101 wants to merge 1 commit intoMCLCE:mainfrom
ModMaker101:fix/compression-tls-thread-crash
Open

Fix autosave thread compression TLS crash.#1544
ModMaker101 wants to merge 1 commit intoMCLCE:mainfrom
ModMaker101:fix/compression-tls-thread-crash

Conversation

@ModMaker101
Copy link
Copy Markdown
Contributor

Description

Fixes a crash in ConsoleSaveFileOriginal::Flush when autosavfe runs on a worker thread with uninitialized Compression TLS.

Changes

Previous Behavior

Server crashes with a read access violation. tls pointer is nullptr in Compression::getCompression because the thread storage slot was never initialized on the save worker thread.

Root Cause

std::thread at ConsoleSaveFileOriginal calls Compression::getCompression without first initializing TLS.

New Behavior

Autosave completes without crashing. Worker thread now properly sets up TLS before calls.

Fix Implementation

Added Compression::UseDefaultThreadStorage at the start of the lambda before any compression calls.

AI Use Disclosure

None.

Related Issues

Side-note

This only happened in Debug mode to my knowledge. I was just getting annoyed with it crashing on me.

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