overlaytopleft/games-fps/gzdoom/files/0025-Fix-iterator-invalidation-for-Map-Get.patch

33 lines
1.0 KiB
Diff
Raw Normal View History

From d09cfff738f53f65efdeb1f39ce5ce1db81ee747 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ricardo=20Lu=C3=ADs=20Vaz=20Silva?= <ricolvs123@gmail.com>
Date: Tue, 17 Jan 2023 16:33:41 -0300
Subject: [PATCH 25/51] Fix iterator invalidation for Map::Get
---
src/common/scripting/core/maps.cpp | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/common/scripting/core/maps.cpp b/src/common/scripting/core/maps.cpp
index 68eab6d3d..bfc2b676d 100644
--- a/src/common/scripting/core/maps.cpp
+++ b/src/common/scripting/core/maps.cpp
@@ -125,6 +125,7 @@ template<typename M> expand_types_vm<typename M::ValueType> MapGet(M * self,expa
{
typename M::ValueType n {};
self->Insert(key,n);
+ self->info->rev++; // invalidate iterators
return n;
}
}
@@ -139,6 +140,7 @@ template<typename M> void MapGetString(M * self,expand_types_vm<typename M::KeyT
{
out = FString();
self->Insert(key,out);
+ self->info->rev++; // invalidate iterators
}
}
--
2.39.3