Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explore reference counting API objects #348

Open
mikerreed opened this issue Jul 5, 2022 · 0 comments
Open

Explore reference counting API objects #348

mikerreed opened this issue Jul 5, 2022 · 0 comments

Comments

@mikerreed
Copy link
Contributor

mikerreed commented Jul 5, 2022

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.

@mikerreed mikerreed self-assigned this Jul 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant