-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
Don't derive Copy for FFI structs/unions that contain pointers #1048
Labels
Comments
I strongly agree. |
sdroege
added a commit
to sdroege/gir
that referenced
this issue
Feb 4, 2021
Clone is still derived to as explicitly cloning the structs is less of a problem, but implicitly copying them can easily cause double frees. Fixes gtk-rs#1048
sdroege
added a commit
to sdroege/gir
that referenced
this issue
Feb 4, 2021
Clone is still derived to as explicitly cloning the structs is less of a problem, but implicitly copying them can easily cause double frees. Fixes gtk-rs#1048
sdroege
added a commit
to sdroege/gir
that referenced
this issue
Feb 4, 2021
Clone is still derived to as explicitly cloning the structs is less of a problem, but implicitly copying them can easily cause double frees. Fixes gtk-rs#1048
sdroege
added a commit
to sdroege/gir
that referenced
this issue
Feb 4, 2021
Clone is still derived to as explicitly cloning the structs is less of a problem, but implicitly copying them can easily cause double frees. Fixes gtk-rs#1048
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In #415 we started deriving
Copy
for all FFI structs and unions. This can easily lead to double frees and related problems because it can be non-obvious from the code that a value is actually copied instead of being moved.https://gitlab.freedesktop.org/gstreamer/gstreamer-rs/-/issues/310 is an example of that.
We should probably stop deriving
Copy
for such structs/unions with pointers.Clone
is still fine as that has to happen explicitly.@EPashkin @GuillaumeGomez @bilelmoussaoui Opinions?
The text was updated successfully, but these errors were encountered: