Closed diwo closed 4 years ago
Hm. It might be better to just use a fixed size array then instead of a vector. Your fix is just a workaround the real issue kinda...
Some kind of linked list would be better, since the vector is used as a stack anyway. I can't get a clear answer on whether std::deque reallocates or not, let me look into this.
I'll put gui's handleInput back so that it's fired regardless of whether it's been handled by an element. It's needed to implement drag-and-release detection without being interrupted. If there's a need to bypass gui's handleInput when it's already handled by an element, the handled flag could be passed to gui's handleInput as an arg.
Changed gui stack implementation from vector to stack backed by linked list. Kept gui->handleInput behavior the same as before.
Summary on reference invalidation for various containers here: https://stackoverflow.com/a/54004916/983429
If
onClick
inhandleInput
callschangeTo
to put new gui ontom_guiStack
, the vector may resize and cause thecurrentGui
reference to no longer be valid, causing a crash.