Fix destructor of SharedArray in C++

We should of course only free the memory if the refcount reaches 0
This commit is contained in:
Olivier Goffart 2020-09-04 16:21:47 +02:00
parent 0751552068
commit 4c07fbfb3d

View file

@ -64,11 +64,11 @@ private:
for (auto it = b; it < e; ++it) {
it->~T();
}
cbindgen_private::sixtyfps_shared_array_free(
reinterpret_cast<uint8_t *>(inner),
sizeof(SharedArrayHeader) + inner->capacity * sizeof(T),
alignof(SharedArrayHeader));
}
cbindgen_private::sixtyfps_shared_array_free(
reinterpret_cast<uint8_t *>(inner),
sizeof(SharedArrayHeader) + inner->capacity * sizeof(T),
alignof(SharedArrayHeader));
}
// Unfortunately, this cannot be generated by cbindgen because std::atomic is not understood