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

[Question] how to make it safe? #125

Open
hasezoey opened this issue Dec 24, 2021 · 0 comments
Open

[Question] how to make it safe? #125

hasezoey opened this issue Dec 24, 2021 · 0 comments

Comments

@hasezoey
Copy link

i ask this here, because github discussions seem to not be enabled for this project


i am still quite new to rust and have no experience in c/c++ (or other low-level / systems languages), and with this project i have to use a lot of unsafe and i also read Unsafety, but i could not understand how i could make it (more) safe, especially the following part got me thinking on how to do it properly:

Rust documentation for Qptr:

It's still possible to cause use-after-free by calling a method through QPtr.
Even in a single threaded program, the accessed object can be deleted by a nested call
while one of its methods is still running. In multithreaded context, the object can be deleted
in another thread between the null check and the method call, also resulting in undefined
behavior.

so my question is: how can i make it safe if it may not be safe after having already checked (like with is_null)?
or how can i at least detect that it is wrong / malfunctioned and catch it to recover from it (like a Result in rust)?

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