subdgtl / WFC

Prototype tools for playing with Wave Function Collapse
The Unlicense
5 stars 1 forks source link

When wfc_world_state_free is called for a wrong address, it crashes without any message. #26

Closed janper closed 2 years ago

janper commented 2 years ago

When wfc_world_state_free is called for a wrong address, it crashes Rhino without any message. This only happens during development and it took me a while (actually it was my first guess) to realize where does the crash occur.

yanchith commented 2 years ago

That is correct. It even says so in the documentation: https://github.com/subdgtl/WFC/blob/master/wfc_dylib/ffi/wfc.hpp#L265

On a more serious note, I understand this makes development unpleasant, but how would you handle this? Imagine you have a function that receives any memory address as a parameter. How would you know the address points to valid memory you previously created without spending resources on tracking it?

EDIT: I accidentally pointed to the other free function, but the point is the same: https://github.com/subdgtl/WFC/blob/master/wfc_dylib/ffi/wfc.hpp#L173

janper commented 2 years ago

I thought so, actually