浏览代码

Fixed alignment bug after buffer reallocation

Previously if a dynamic back buffer is full and reallocated then the
current allocation alignment will be alignet at the direct memory
address instead of memory address minus size. This is now fixed and
alignment should work correctly.
vurtun 9 年之前
父节点
当前提交
76ba0b2374
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      nuklear.h

+ 1 - 1
nuklear.h

@@ -4384,7 +4384,7 @@ nk_buffer_alloc(struct nk_buffer *b, enum nk_buffer_allocation_type type,
         /* align newly allocated pointer */
         if (type == NK_BUFFER_FRONT)
             unaligned = nk_ptr_add(void, b->memory.ptr, b->allocated);
-        else unaligned = nk_ptr_add(void, b->memory.ptr, b->size);
+        else unaligned = nk_ptr_add(void, b->memory.ptr, b->size - size);
         memory = nk_buffer_align(unaligned, align, &alignment, type);
     }