Skip to content

[GEN][ZH] Workaround for checking 'this' pointer#865

Closed
Caball009 wants to merge 2 commits into
TheSuperHackers:mainfrom
Caball009:check_this_pointer_workaround
Closed

[GEN][ZH] Workaround for checking 'this' pointer#865
Caball009 wants to merge 2 commits into
TheSuperHackers:mainfrom
Caball009:check_this_pointer_workaround

Conversation

@Caball009

@Caball009 Caball009 commented May 16, 2025

Copy link
Copy Markdown

Checking the this pointer is undefined behavior and such checks may be elided by the compiler at any moment. Clang-cl doesn't check the pointer value (at higher optimization levels, at least), so the game crashes before it can get to the main menu.

Using a volatile pointer will force the compiler to emit more instructions, so there'll be a very small but inevitable inefficiency.
This is a workaround, not a fix. The issue is that fixing this would probably require changing all 1000+ calls to deleteInstance.

@Skyaero42 Skyaero42 added Gen Relates to Generals ZH Relates to Zero Hour Stability Concerns stability of the runtime labels May 16, 2025
@xezon xezon closed this in #870 May 18, 2025
@Caball009 Caball009 deleted the check_this_pointer_workaround branch May 18, 2025 11:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Gen Relates to Generals Stability Concerns stability of the runtime ZH Relates to Zero Hour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants