From 8b39c443fe711fd311d1fabc6273b023bd242694 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Andre Date: Fri, 23 Aug 2013 18:01:22 +0900 Subject: [PATCH] evas/cserve2: Fix lag with invalid font glyphs --- src/bin/evas/evas_cserve2_fonts.c | 11 +++++++++-- src/bin/evas/evas_cserve2_main.c | 16 ++++++++-------- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/src/bin/evas/evas_cserve2_fonts.c b/src/bin/evas/evas_cserve2_fonts.c index ed0698cbaf..b9da989d28 100644 --- a/src/bin/evas/evas_cserve2_fonts.c +++ b/src/bin/evas/evas_cserve2_fonts.c @@ -335,7 +335,7 @@ _font_slave_glyph_render(Font_Info *fi, Slave_Msg_Font_Glyphs_Loaded *response, if (!glyphsize) { FT_Done_Glyph(glyph); - return EINA_FALSE; + goto on_error; } buffer_id = cserve2_shared_mempool_buffer_new(response->mempool, glyphsize); @@ -343,7 +343,7 @@ _font_slave_glyph_render(Font_Info *fi, Slave_Msg_Font_Glyphs_Loaded *response, if (!data) { FT_Done_Glyph(glyph); - return EINA_FALSE; + goto on_error; } memcpy(data, bglyph->bitmap.buffer, glyphsize); @@ -363,6 +363,13 @@ _font_slave_glyph_render(Font_Info *fi, Slave_Msg_Font_Glyphs_Loaded *response, FT_Done_Glyph(glyph); return EINA_TRUE; + +on_error: + // Create invalid entry for this index. + memset(&response->glyphs[response->nglyphs], 0, sizeof(Slave_Msg_Glyph)); + response->glyphs[response->nglyphs].index = idx; + response->nglyphs++; + return EINA_FALSE; } static void diff --git a/src/bin/evas/evas_cserve2_main.c b/src/bin/evas/evas_cserve2_main.c index 1509a9cd07..fa70fece3b 100644 --- a/src/bin/evas/evas_cserve2_main.c +++ b/src/bin/evas/evas_cserve2_main.c @@ -24,15 +24,15 @@ cserve2_client_error_send(Client *client, unsigned int rid, int error_code) int size; Msg_Error msg; - // clear the struct with possible paddings, since it is not aligned. - memset(&msg, 0, sizeof(msg)); - msg.base.rid = rid; - msg.base.type = CSERVE2_ERROR; - msg.error = error_code; + // clear the struct with possible paddings, since it is not aligned. + memset(&msg, 0, sizeof(msg)); + msg.base.rid = rid; + msg.base.type = CSERVE2_ERROR; + msg.error = error_code; - size = sizeof(msg); - cserve2_client_send(client, &size, sizeof(size)); - cserve2_client_send(client, &msg, sizeof(msg)); + size = sizeof(msg); + cserve2_client_send(client, &size, sizeof(size)); + cserve2_client_send(client, &msg, sizeof(msg)); } void