From 7a1ec9ab9d2a38bc0891bbeff7174f1d22c82f82 Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Sat, 20 Jan 2018 13:53:13 +0200 Subject: [PATCH] Applied values to latched CVARs in correct order https://forum.zdoom.org/viewtopic.php?t=59159 --- src/c_cvars.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/c_cvars.cpp b/src/c_cvars.cpp index 6b0b62da7..d51dacdcb 100644 --- a/src/c_cvars.cpp +++ b/src/c_cvars.cpp @@ -1639,9 +1639,7 @@ FBaseCVar *C_CreateCVar(const char *var_name, ECVarType var_type, uint32_t flags void UnlatchCVars (void) { - FLatchedValue var; - - while (LatchedValues.Pop (var)) + for (const FLatchedValue& var : LatchedValues) { uint32_t oldflags = var.Variable->Flags; var.Variable->Flags &= ~(CVAR_LATCH | CVAR_SERVERINFO); @@ -1650,6 +1648,8 @@ void UnlatchCVars (void) delete[] var.Value.String; var.Variable->Flags = oldflags; } + + LatchedValues.Clear(); } void DestroyCVarsFlagged (uint32_t flags)