pimoroni / picosystem

PicoSystem libraries and examples.
MIT License
145 stars 33 forks source link

Buffer fixes #87

Closed ahnlak closed 2 years ago

ahnlak commented 2 years ago

Very small fix to initialise allocated storage when creating a new buffer; otherwise you end up with junk in your buffer, and I've had variable success in clearing it up.

The larger fix is to track when buffer() allocates memory when creating a new buffer_t object, and to delete it properly on destruction. Obviously only an issue if you create/discard a lot of buffers, but still...

ahnlak commented 2 years ago

(added the python linting fixes mentioned here)

Gadgetoid commented 2 years ago

LGTM! Thank you.

joewreschnig commented 1 year ago

The destructor unfortunately prevents buffer_t from being used as part of a constexpr (among other things). What about a subtype or wrapper for buffers owning their memory instead?