mvz / gir_ffi

Auto-generate bindings for GObject based libraries at run time using FFI
https://github.com/mvz/gir_ffi/wiki
GNU Lesser General Public License v2.1
143 stars 14 forks source link

Avoid potentially accessing data after deallocation in unref spec #346

Closed mvz closed 1 year ago

mvz commented 1 year ago

After the last #unref, derived_instance's struct data may be deallocated, so fetching its refcount field is unreliable. By first increasing the refcount, checking that #unref decreases the refcount can be tested reliably.