From c3f29220eac1d1ed90f1262a55cd65c41d7a3b1e Mon Sep 17 00:00:00 2001 From: aura Date: Sat, 14 Mar 2026 01:12:57 +0100 Subject: fix textures in 2d render, some bugfix --- src/util/allocator.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/util/allocator.h') diff --git a/src/util/allocator.h b/src/util/allocator.h index ff3d3c5..327dfc1 100644 --- a/src/util/allocator.h +++ b/src/util/allocator.h @@ -76,9 +76,9 @@ struct LIST { size = 0; } - LIST( U32 _size, const T* data ) { + LIST( U32 _size, const T* _data ) { data = (T*)malloc( sizeof( T ) * _size ); - memcpy( data, data, _size * sizeof( T ) ); + memcpy( data, _data, _size * sizeof( T ) ); size = _size; capacity = _size; } -- cgit v1.2.3 From fdc5e8760fb7ac0af8e7ebb98a2076db15e31082 Mon Sep 17 00:00:00 2001 From: aura Date: Mon, 16 Mar 2026 10:15:01 +0100 Subject: giga refactor, fix ALL the leaks --- src/util/allocator.h | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src/util/allocator.h') diff --git a/src/util/allocator.h b/src/util/allocator.h index 327dfc1..623d227 100644 --- a/src/util/allocator.h +++ b/src/util/allocator.h @@ -2,8 +2,7 @@ #include #include -#include -#include "typedef.h" +#include "callback.h" template struct LIST_ITERATOR { @@ -19,7 +18,7 @@ struct LIST_ITERATOR { }; template -using QSORT_FN = std::function< U8( T*, T* ) >; +using QSORT_FN = FN< U8( T*, T* ) >; template static U8 qsort_basic_sort( T* t1, T* t2 ) { @@ -58,8 +57,8 @@ struct LIST { U32 capacity; U32 size; - using ON_EACH_FN = std::function< void(T*) >; - using ON_SEARCH_FN = std::function< bool(T*) >; + using ON_EACH_FN = FN< void(T*) >; + using ON_SEARCH_FN = FN< U8(T*) >; LIST() { data = (T*)malloc( sizeof( T ) ); @@ -265,6 +264,8 @@ struct LIST { } T ret = data[--size]; + if constexpr( !__is_trivially_destructible(T) ) + data[size].~T(); if( size < capacity / 4 ) shrink(); -- cgit v1.2.3