mirror of
https://github.com/ZDoom/qzdoom.git
synced 2024-12-11 21:21:47 +00:00
- prevent appearance of dangling pointers in corpse queue
A dangling pointer in corpse queue may appear if actor is added to the queue when GC is in propagation state. Enqueued corpse actor remains white, and if it’s destroyed and garbage collected before dequeue, a dangling pointer will be accessed during its removal from the queue. In console, do `summon CorpseSpawner` and `gc now` with the following script loaded. Without a write barrier, it will crash in two seconds. ``` class TestCorpse : Actor { States { Spawn: POSS U 1 A_Die; Death: POSS U 1 A_QueueCorpse; Stop; } } class CorpseSpawner : Actor { override void Tick() { A_SpawnItem("TestCorpse"); } } ``` https://forum.zdoom.org/viewtopic.php?t=69842
This commit is contained in:
parent
9b3782ea0f
commit
a9ad3d1fc3
1 changed files with 1 additions and 0 deletions
|
@ -105,6 +105,7 @@ DEFINE_ACTION_FUNCTION(AActor, A_QueueCorpse)
|
||||||
corpsequeue.Delete(0);
|
corpsequeue.Delete(0);
|
||||||
}
|
}
|
||||||
corpsequeue.Push(self);
|
corpsequeue.Push(self);
|
||||||
|
GC::WriteBarrier(self);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue