rive-cpp-legacy
rive-cpp-legacy copied to clipboard
Explore reference counting API objects
Today we return some objects that have bare back-pointers to other objects. This is fragile, and can allow a sloppy client to accidentally delete the parent object, but still try to reference the child (whose back-pointer is not dangling).
Idea
- explore reference counting these parent objects, so this scenario cannot happen.
Specifics
- ArtboarInstance inherit from rive::rcp (the base class we use for RenderBuffers)
- Change the child objects and are handed to the client to call unref() on their parent when they are deleted
-
(ArtboardInstance, Scene)
If this works out, the SDKs will not need to do anything. If this does not workout, we may need to modify the SDKs' high-level "wrapper" objects to keep references to the parent objects, to avoid this dangling problem.