KhronosGroup / KTX-Software

KTX (Khronos Texture) Library and Tools
Other
866 stars 227 forks source link

ktxTexture_SetImageFromMemory should document pointer lifetime guarantees #914

Closed matthew-rister closed 3 months ago

matthew-rister commented 4 months ago

ktxTexture_SetImageFromMemory (and friends) expect a const ktx_uint8_t* to the image source in memory. It's unclear if this takes over ownership of the pointer or if it creates a copy of the underlying image memory. Upon further investigation, it appears it creates a copy of the image memory.

To better help users avoid memory leaks (by e.g. assuming a memory ownership transfer), corresponding KTX APIs should be updates to include a note about pointer lifetime assumptions.

MarkCallow commented 4 months ago

Please propose a PR.

matthew-rister commented 4 months ago

@MarkCallow I have submitted a brief pull request with proposed documentation updates.