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

Consider safety of almost all API calls #75

Open
kenz-gelsoft opened this issue Jun 1, 2022 · 1 comment
Open

Consider safety of almost all API calls #75

kenz-gelsoft opened this issue Jun 1, 2022 · 1 comment

Comments

@kenz-gelsoft
Copy link
Owner

kenz-gelsoft commented Jun 1, 2022

wx manages (almost all) wxWindows' pointers which is in widgets tree.

This means that any operation potentially makes any pointers invalid.

This should be expressed unsafe in Rust, how can we do this?

@kenz-gelsoft
Copy link
Owner Author

kenz-gelsoft commented Jun 2, 2022

Marking following methods unsafe may make it programmer's responsibility

  • destroy()
  • any close operations of wxWindows (which results destroying wx managed pointers)

I think this is a reasonable compromise than other approaches like:

  • Programmer checks all wx calls is safe by:
    • Making all calls returns Result and fallible
    • Checking every reference to wx-managed pointer by get()ing from wx::WeakRef.

Those approaches will increase run-time overhead unreasonablly. As a Rust library, this isn't desirable.

Providing unsafe and performant variants to whole APIs doubles the work for binding.

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