Skip to content

Comments

Fix race condition in CUtlSymbolTableMT lookup#1807

Open
ficool2 wants to merge 1 commit intoValveSoftware:masterfrom
ficool2:utlsymbolmt_lookup
Open

Fix race condition in CUtlSymbolTableMT lookup#1807
ficool2 wants to merge 1 commit intoValveSoftware:masterfrom
ficool2:utlsymbolmt_lookup

Conversation

@ficool2
Copy link
Contributor

@ficool2 ficool2 commented Feb 15, 2026

See #612 for an explanation of how the race condition arises

This PR puts the search string on the stack, which prevents threads from reading a stale pointer that got switched out between execution

This mainly fixes flickering water materials. Materialsystem uses a CUtlSymbolTableMT lookup for material vars internally, and therefore it will occasionally read a stale state for fog parameters

class CStringPoolIndexSearch : public CStringPoolIndex
{
public:
CStringPoolIndexSearch( const char* pString ) : CStringPoolIndex( 0xFFFF, 0xFFFF )
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice trick, thanks!

dimhotepus added a commit to Source-Authors/Obsoletium that referenced this pull request Feb 16, 2026
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.

2 participants