setting a cvar back to its default frees the latched string

This commit is contained in:
myT 2019-09-25 05:12:05 +02:00
parent 30c8990d6b
commit 2d806401eb
2 changed files with 8 additions and 1 deletions

View file

@ -3,6 +3,8 @@ DD Mmm 19 - 1.52
fix: r_monitor on Linux is now 0-based and the value doesn't change incorrectly on its own anymore
fix: when a latched cvar's value is set to its default, the cvar is no longer marked as changed
31 Mar 19 - 1.51

View file

@ -304,8 +304,13 @@ static cvar_t* Cvar_Set2( const char *var_name, const char *value, qbool force )
}
const qbool okValue = Cvar_IsValidValue(var, value, qtrue);
if (okValue && !strcmp(value, var->string))
if (okValue && !strcmp(value, var->string)) {
if (var->latchedString) {
Z_Free(var->latchedString);
var->latchedString = NULL;
}
return var;
}
if (!okValue) {
if (!Cvar_IsValidValue(var, var->resetString, qfalse))