rust-sfml icon indicating copy to clipboard operation
rust-sfml copied to clipboard

Fonts loaded from memory require the source data buffer to be kept available

Open cpardotortosa opened this issue 2 years ago • 2 comments

There is a warning about this on sfml documentation

When using this with rust, the font does not work if the buffer is dropped. This should be in the documentation.

cpardotortosa avatar Feb 19 '22 20:02 cpardotortosa

I think for the time being I'll make from_memory unsafe and document the behavior. It would pollute the Font/Text APIs with lifetimes to fix this more thoroughly, which I don't have motivation for right now.

crumblingstatue avatar Feb 20 '22 19:02 crumblingstatue

I created https://github.com/jeremyletang/rust-sfml/commit/7cc48d5781cacf85f31aa65a0b79eced5da3941f to address this.

crumblingstatue avatar Feb 20 '22 20:02 crumblingstatue