mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-25 13:31:37 +00:00
Add Missing Read Barriers to Map Get Functions
This commit is contained in:
parent
fed2d11be5
commit
a397a93c25
1 changed files with 34 additions and 5 deletions
|
@ -118,8 +118,16 @@ template<typename M> unsigned int MapCountUsed(M * self)
|
|||
template<typename M> expand_types_vm<typename M::ValueType> MapGet(M * self,expand_types_vm<typename M::KeyType> key)
|
||||
{
|
||||
typename M::ValueType * v = self->CheckKey(key);
|
||||
if (v) {
|
||||
return *v;
|
||||
if (v)
|
||||
{
|
||||
if constexpr(std::is_same_v<typename M::ValueType, DObject*>)
|
||||
{
|
||||
return GC::ReadBarrier(*v);
|
||||
}
|
||||
else
|
||||
{
|
||||
return *v;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -148,7 +156,14 @@ template<typename M> expand_types_vm<typename M::ValueType> MapGetIfExists(M * s
|
|||
{
|
||||
typename M::ValueType * v = self->CheckKey(key);
|
||||
if (v) {
|
||||
return *v;
|
||||
if constexpr(std::is_same_v<typename M::ValueType, DObject*>)
|
||||
{
|
||||
return GC::ReadBarrier(*v);
|
||||
}
|
||||
else
|
||||
{
|
||||
return *v;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -177,7 +192,14 @@ template<typename M> expand_types_vm<typename M::ValueType> MapCheckValue(M * se
|
|||
{
|
||||
typename M::ValueType * v = self->CheckKey(key);
|
||||
if ((*exists = !!v)) {
|
||||
return *v;
|
||||
if constexpr(std::is_same_v<typename M::ValueType, DObject*>)
|
||||
{
|
||||
return GC::ReadBarrier(*v);
|
||||
}
|
||||
else
|
||||
{
|
||||
return *v;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -288,7 +310,14 @@ template<typename I> void MapIteratorGetKeyString(I * self, FString &out)
|
|||
|
||||
template<typename I> expand_types_vm<typename I::ValueType> MapIteratorGetValue(I * self)
|
||||
{
|
||||
return self->GetValue();
|
||||
if constexpr(std::is_same_v<typename I::ValueType, DObject*>)
|
||||
{
|
||||
return GC::ReadBarrier(self->GetValue());
|
||||
}
|
||||
else
|
||||
{
|
||||
return self->GetValue();
|
||||
}
|
||||
}
|
||||
|
||||
template<typename I> void MapIteratorGetValueString(I * self, FString &out)
|
||||
|
|
Loading…
Reference in a new issue