Fixed the heap-use-after-free issue.

Just standard multithreading stuff; access to the allocator while hot
threads are running means stuff can change underneath us even /during/
a read.  I've mutex locked state for stuff in the drawing domain which
stops this issue.
This commit is contained in:
2025-12-12 04:29:32 +00:00
parent 5d78cb20df
commit a5666328b7
4 changed files with 12 additions and 4 deletions

View File

@@ -30,10 +30,14 @@ on the number line.
We already have the latest bound nodes so we're part-way through the
tree. Just keep going down what we have so far surely? Even better,
don't use nodes _at all_. Run with an index!
** TODO Fix weird issue at past 100K nodes
** DONE Fix weird issue at past 100K nodes
std::vector seems to crap itself past 100K nodes - we keep getting
heap-use-after-free issues when trying to access the allocator nodes
at that point. Seemingly random. What's going on?
Solution: _everytime_ we want to access the allocator for nontrivial
(like memory reads) we need to lock the mutex. No two ways about it.
All draw functions were causing the issue.
** DONE Prettify code base
It's a big blob of code currently in the graphics portion. Not very
pretty but it gets the job done. Try modularisation.