Browse Source

fixed memory crash in baker

Ron Aaron 5 years ago
parent
commit
1126fd77da
2 changed files with 2 additions and 2 deletions
  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);
         } while ((i = i->n) != iter);
     }
     }
     *temp = (nk_size)*glyph_count * sizeof(struct stbrp_rect);
     *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)*glyph_count * sizeof(stbtt_packedchar);
     *temp += (nk_size)count * sizeof(struct nk_font_bake_data);
     *temp += (nk_size)count * sizeof(struct nk_font_bake_data);
     *temp += sizeof(struct nk_font_baker);
     *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);
         } while ((i = i->n) != iter);
     }
     }
     *temp = (nk_size)*glyph_count * sizeof(struct stbrp_rect);
     *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)*glyph_count * sizeof(stbtt_packedchar);
     *temp += (nk_size)count * sizeof(struct nk_font_bake_data);
     *temp += (nk_size)count * sizeof(struct nk_font_bake_data);
     *temp += sizeof(struct nk_font_baker);
     *temp += sizeof(struct nk_font_baker);