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

wrap the raw notcurses pointer to ensure proper dropping order #10

Merged
merged 4 commits into from
Oct 3, 2024

Conversation

joseluis
Copy link
Collaborator

@joseluis joseluis commented Oct 2, 2024

  • wrap the *mut Nc pointer as a field of the new NotcursesInner.
  • store Rc<RefCell<NotcursesInner>> as a field of Notcurses.
  • store a reference counted clone in each Plane.
  • move the Drop impl to NotcursesInner.

fixes #8

- replace `Notcurses`' `into_ref` and `into_ref_mut` functions with `with_nc` and `with_nc_mut`.
- remove the `impl From<NcPlane> for Plane`, and replace it with the `from_ncplane` method.
- update the signature of methods that doesn't require a mutable reference to `Notcurses`.
- update `Notcurses`, `Plane`, `Visual` `Statistics` and `Palette`.
- update `Notcurses`:
  - store `NotcursesInner` wrapping the raw pointer.
  - move proper shutdown functionality to `NotcursesInner`.
- update `Plane`:
  - store a cloned reference to `NotcursesInner`.
- store a cloned reference to `NotcursesInner` in `Visual`.
- require a new `Notcurses` argument in `VisualBuilder` methods: `build_from_rgba`, `build_from_rgb`, `build_from_rgbx`, `build_from_bgra`, `build_from_file`, `build_from_sixel`, `build_from_palidx`.
- require a new `Notcurses` argument in `Visual` methods: `from_rgba`, `from_rgb`, `from_rgbx`, `from_bgra`, `from_file`.
- update visibility `Notcurses.options` and `Plane.notcurses`.
- update example `visual`.
- update `Plane` methods to only require a shared reference to `Notcurses`: `from_cli`, `new_at`, `new_sized`, `new_sized_at`.
- update examples: `visual`, `hello-world`, `cli`, `info`, `input` and
  the one in the readme.
@joseluis joseluis force-pushed the feature-rc-refcell branch from 8d41da2 to a29fd47 Compare October 3, 2024 10:09
@joseluis joseluis merged commit eede764 into main Oct 3, 2024
3 checks passed
@joseluis joseluis deleted the feature-rc-refcell branch October 3, 2024 11:02
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

Successfully merging this pull request may close these issues.

Use-after-free in Notcurses Drop impl.
1 participant