diff --git a/include/kf/Bitmap.h b/include/kf/Bitmap.h index af3ce99..336f8d9 100644 --- a/include/kf/Bitmap.h +++ b/include/kf/Bitmap.h @@ -32,6 +32,7 @@ namespace kf { if (&other != this) { + deinitialize(); m_header = other.m_header; other.m_header = {}; } diff --git a/include/kf/MapAllocator.h b/include/kf/MapAllocator.h index 439a912..424c86e 100644 --- a/include/kf/MapAllocator.h +++ b/include/kf/MapAllocator.h @@ -57,10 +57,9 @@ namespace kf return buffer; } - void deallocate(T*, std::size_t) + void deallocate(T* buf, std::size_t) { - m_state->buffer.reset(); - m_state->size = 0; + delete buf; } [[nodiscard]] bool prepareMemory(std::size_t size) @@ -70,7 +69,7 @@ namespace kf return false; } - if (m_state->buffer) + if (m_state->buffer && m_state->size == size) { return true; }