RData types should be able to interact with the active Runtime in their destructor. For example, a Sprite rdata may wish to deregister itself from the Graphics lib when the user calls (free! the-spr).
Currently, when a Runtimeis dropped, it deinitializes all Libs before cleaning up any RData on the heap, and it holds dynamic borrows of certain data structures internal to the GC heap while running RData destructors. This means that practically any interaction with the active Runtime will panic.
The fix will be to have a separate pass where all RData on the heap are freed (as though using the built-in function free!) before doing any other cleanup - in particular, before dropping any Libs.
If possible, we should also add dynamic checks to forbid any RData from calling glsp::add_lib or glsp::rdata in their destructor.
RData
types should be able to interact with the activeRuntime
in their destructor. For example, aSprite
rdata may wish to deregister itself from theGraphics
lib when the user calls(free! the-spr)
.Currently, when a
Runtime
is dropped, it deinitializes allLibs
before cleaning up anyRData
on the heap, and it holds dynamic borrows of certain data structures internal to the GC heap while runningRData
destructors. This means that practically any interaction with the activeRuntime
will panic.The fix will be to have a separate pass where all
RData
on the heap are freed (as though using the built-in functionfree!
) before doing any other cleanup - in particular, before dropping anyLibs
.If possible, we should also add dynamic checks to forbid any
RData
from callingglsp::add_lib
orglsp::rdata
in their destructor.