浏览代码

fixed memory crash in baker

Ron Aaron 5 年之前
父节点
当前提交
1126fd77da
共有 2 个文件被更改,包括 2 次插入2 次删除
  1. 1 1
      nuklear.h
  2. 1 1
      src/nuklear_font.c

+ 1 - 1
nuklear.h

@@ -16341,7 +16341,7 @@ nk_font_baker_memory(nk_size *temp, int *glyph_count,
         } while ((i = i->n) != iter);
     }
     *temp = (nk_size)*glyph_count * sizeof(struct stbrp_rect);
-    *temp += (nk_size)total_range_count * sizeof(stbtt_pack_range);
+    *temp += (nk_size)*glyph_count * sizeof(stbtt_pack_range);
     *temp += (nk_size)*glyph_count * sizeof(stbtt_packedchar);
     *temp += (nk_size)count * sizeof(struct nk_font_bake_data);
     *temp += sizeof(struct nk_font_baker);

+ 1 - 1
src/nuklear_font.c

@@ -138,7 +138,7 @@ nk_font_baker_memory(nk_size *temp, int *glyph_count,
         } while ((i = i->n) != iter);
     }
     *temp = (nk_size)*glyph_count * sizeof(struct stbrp_rect);
-    *temp += (nk_size)total_range_count * sizeof(stbtt_pack_range);
+    *temp += (nk_size)*glyph_count * sizeof(stbtt_pack_range);
     *temp += (nk_size)*glyph_count * sizeof(stbtt_packedchar);
     *temp += (nk_size)count * sizeof(struct nk_font_bake_data);
     *temp += sizeof(struct nk_font_baker);