albertodemichelis / squirrel

Official repository for the programming language Squirrel
http://www.squirrel-lang.org
MIT License
913 stars 156 forks source link

`SQVM::PopGet()` leaves lingering object references #287

Open samisalreadytaken opened 5 months ago

samisalreadytaken commented 5 months ago

SQVM::PopGet() does not clear stack position, leaving lingering objects in the stack until either that position is overwritten or the VM is killed. This can cause unexpected behaviour in code that relies on it.

It should probably behave like Top(); Pop(); as its name suggests, nullifying the stack position.

https://github.com/albertodemichelis/squirrel/blob/c02bf2dfd599a0b99b814d486512a3ee934667f1/squirrel/sqvm.cpp#L1765