Skip to content

Commit

Permalink
Allow environment hint overrides before hints are initialized
Browse files Browse the repository at this point in the history
Fixes #10514
  • Loading branch information
slouken committed Aug 9, 2024
1 parent 78b1e0e commit 2b85312
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions src/SDL_hints.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,23 +196,21 @@ const char *SDL_GetHint(const char *name)
return NULL;
}

const SDL_PropertiesID hints = GetHintProperties(SDL_FALSE);
if (!hints) {
return NULL;
}

const char *retval = SDL_getenv(name);

SDL_LockProperties(hints);
const SDL_PropertiesID hints = GetHintProperties(SDL_FALSE);
if (hints) {
SDL_LockProperties(hints);

SDL_Hint *hint = SDL_GetPointerProperty(hints, name, NULL);
if (hint) {
if (!retval || hint->priority == SDL_HINT_OVERRIDE) {
retval = SDL_GetPersistentString(hint->value);
SDL_Hint *hint = SDL_GetPointerProperty(hints, name, NULL);
if (hint) {
if (!retval || hint->priority == SDL_HINT_OVERRIDE) {
retval = SDL_GetPersistentString(hint->value);
}
}
}

SDL_UnlockProperties(hints);
SDL_UnlockProperties(hints);
}

return retval;
}
Expand Down

0 comments on commit 2b85312

Please sign in to comment.