From 93b2a504e74e6a25c4cadbd66a1111af31b991f3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jean-Philippe=20Bruy=C3=A8re?= Date: Tue, 8 Jan 2019 03:09:59 +0100 Subject: [PATCH] resolve release build sigsev --- src/vkvg_device_internal.h | 1 + src/vkvg_fonts.c | 10 +++++----- src/vkvg_fonts.h | 10 ++++++++++ tests/vkengine.c | 5 ++--- vkh | 2 +- 5 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/vkvg_device_internal.h b/src/vkvg_device_internal.h index ac47984..e736683 100644 --- a/src/vkvg_device_internal.h +++ b/src/vkvg_device_internal.h @@ -89,6 +89,7 @@ typedef struct _vkvg_device_t{ VkhImage emptyImg;//prevent unbound descriptor to trigger Validation error 61 VkSampleCountFlags samples;//samples count for all surfaces + vkvg_status_t status; _font_cache_t* fontCache; VkvgContext lastCtx; //double linked list last elmt diff --git a/src/vkvg_fonts.c b/src/vkvg_fonts.c index 21049d1..3215fa0 100644 --- a/src/vkvg_fonts.c +++ b/src/vkvg_fonts.c @@ -34,7 +34,7 @@ void _init_fonts_cache (VkvgDevice dev){ cache->config = FcInitLoadConfigAndFonts(); - assert(!FT_Init_FreeType(&cache->library)); + FT_CHECK_RESULT(FT_Init_FreeType(&cache->library)); cache->cacheTexLength = FONT_CACHE_INIT_LAYERS; cache->cacheTex = vkh_tex2d_array_create ((VkhDevice)dev, VK_FORMAT_R8_UNORM, FONT_PAGE_SIZE, FONT_PAGE_SIZE, @@ -174,7 +174,7 @@ void _dump_glyphs (FT_Face face){ char gname[256]; for (int i = 0; i < face->num_glyphs; ++i) { - assert(!FT_Load_Glyph(face,i,FT_LOAD_RENDER)); + FT_CHECK_RESULT(FT_Load_Glyph(face,i,FT_LOAD_RENDER)); slot = face->glyph; FT_Get_Glyph_Name(face,i,gname,256); @@ -227,7 +227,7 @@ void _flush_chars_to_tex (VkvgDevice dev, _vkvg_font_t* f) { } _char_ref* _prepare_char (VkvgDevice dev, _vkvg_font_t* f, FT_UInt gindex){ - assert(!FT_Load_Glyph(f->face, gindex, FT_LOAD_RENDER)); + FT_CHECK_RESULT(FT_Load_Glyph(f->face, gindex, FT_LOAD_RENDER)); FT_GlyphSlot slot = f->face->glyph; FT_Bitmap bmp = slot->bitmap; @@ -319,8 +319,8 @@ void _update_current_font (VkvgContext ctx) { nf.fontFile = (char*)calloc(strlen(ctx->selectedFont.fontFile),sizeof(char)); strcpy (nf.fontFile, ctx->selectedFont.fontFile); - assert(!FT_New_Face(cache->library, nf.fontFile, 0, &nf.face)); - assert(!FT_Set_Char_Size(nf.face, 0, nf.charSize, dev->hdpi, dev->vdpi )); + FT_CHECK_RESULT(FT_New_Face(cache->library, nf.fontFile, 0, &nf.face)); + FT_CHECK_RESULT(FT_Set_Char_Size(nf.face, 0, nf.charSize, dev->hdpi, dev->vdpi )); nf.hb_font = hb_ft_font_create(nf.face, NULL); nf.charLookup = (_char_ref**)calloc(nf.face->num_glyphs,sizeof(_char_ref*)); diff --git a/src/vkvg_fonts.h b/src/vkvg_fonts.h index 84f6128..ac5ad8c 100644 --- a/src/vkvg_fonts.h +++ b/src/vkvg_fonts.h @@ -34,6 +34,16 @@ #define FONT_CACHE_INIT_LAYERS 2 #define FONT_FILE_NAME_MAX_SIZE 256 +#define FT_CHECK_RESULT(f) \ +{ \ + FT_Error res = (f); \ + if (res != 0) \ + { \ + printf("Fatal : FreeType error is %d in %s at line %d\n", res, __FILE__, __LINE__); \ + assert(res == 0); \ + } \ +} + #include "vkvg_internal.h" #include "vkvg.h" #include "vkvg_buff.h" diff --git a/tests/vkengine.c b/tests/vkengine.c index 148fc67..435a054 100644 --- a/tests/vkengine.c +++ b/tests/vkengine.c @@ -94,10 +94,9 @@ vk_engine_t* vkengine_create (VkPhysicalDeviceType preferedGPU, uint32_t width, glfwWindowHint(GLFW_DECORATED, GLFW_TRUE); e->window = glfwCreateWindow (width, height, "Window Title", NULL, NULL); - VkSurfaceKHR surf; - - assert (glfwCreateWindowSurface(e->app->inst, e->window, NULL, &surf)==VK_SUCCESS); + VkSurfaceKHR surf; + VkResult res = glfwCreateWindowSurface(e->app->inst, e->window, NULL, &surf); VkhPhyInfo* phys = vkh_app_get_phyinfos (e->app, &phyCount, surf); diff --git a/vkh b/vkh index f2b18c9..012ca28 160000 --- a/vkh +++ b/vkh @@ -1 +1 @@ -Subproject commit f2b18c96b0a919a35edaf13ee42593ee3ee55095 +Subproject commit 012ca283a29bca6dd6b828406fe490ff356484f1 -- 2.47.3