Source-1-Games icon indicating copy to clipboard operation
Source-1-Games copied to clipboard

Ctrl + Shift + Alt + R on VGUI panels in select games crashes to desktop

Open Squid-Eevee opened this issue 7 months ago • 2 comments

A comment in TF2's pdacontrolpanelscheme.res file mentions that holding Ctrl+Shift+Alt and pressing R will reload the file. Trying this in Half-Life 2, either of it's episodes, or Lost Coast shows that it's intended to reload all scheme files. This also works fine in Left 4 Dead 2. Changes made to sourcescheme.res are applied to any VGUI panel by focusing it, using the key combination, then closing and reopening it. The changes will also apply to any panel opened after the key combination is used. Attempting this in Team Fortress 2, Portal, Portal 2, or Source SDK Base 2013 Single/Multiplayer will result in a crash, forcing the user to relaunch the game. Since I don't own every Source 1 game, this is as many games as I could test, but it's possible this issue could exist in other Source 1 games. The easiest way to replicate this crash would be to open the developer console in one of the relevant games (enabling it in the options first if it isn't already) and then trying the key combination while the window is focused.

Squid-Eevee avatar May 04 '25 02:05 Squid-Eevee

This crash also occurs in Half-Life Deathmatch: Source, Half-Life 2: Deathmatch, Day of Defeat: Source, Counter-Strike: Source and Left 4 Dead 1.

RiverHornet3209 avatar May 12 '25 21:05 RiverHornet3209

Crash occurs due to use-after-free here https://github.com/ValveSoftware/source-sdk-2013/blob/b2705ba55b3b802b86ef2b2dbf97939c9d4fb685/src/vgui2/vgui_controls/Panel.cpp#L1182

When you do a scheme reload, it is handled by Frame here https://github.com/ValveSoftware/source-sdk-2013/blob/b2705ba55b3b802b86ef2b2dbf97939c9d4fb685/src/vgui2/vgui_controls/Frame.cpp#L2173

Looks like it frees the borders for controls, but the problem is such borders are still used in render cycle. Access to freed border causes crash.

Fix, for example, is to hold the weak reference to parent control inside border when do SetBorder. And when SchemeManager frees borders due to a scheme reload, need to reset borders for parent controls by border->parent->SetBorder(nullptr).

dimhotepus avatar Nov 15 '25 01:11 dimhotepus