summaryrefslogtreecommitdiff
path: root/src/lib/evas/cserve2
diff options
context:
space:
mode:
authorJean-Philippe Andre <jp.andre@samsung.com>2013-10-02 15:05:44 +0900
committerJean-Philippe Andre <jp.andre@samsung.com>2013-10-28 15:47:15 +0900
commit2cd0b316f156efef4891dff9b1aba23ae50f1ff5 (patch)
treee56221d9be6d5095180cfe3f8e442e35e2d7a27c /src/lib/evas/cserve2
parent6f485d2a125be78388ffa95d88b041b20b8724ec (diff)
evas/cserve2: Fix CList usage
In some error cases, the list could become a cycle. Foreach would then loop forever!
Diffstat (limited to 'src/lib/evas/cserve2')
-rw-r--r--src/lib/evas/cserve2/evas_cs2_client.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/src/lib/evas/cserve2/evas_cs2_client.c b/src/lib/evas/cserve2/evas_cs2_client.c
index fa29fab223..cf3e1b7a1e 100644
--- a/src/lib/evas/cserve2/evas_cs2_client.c
+++ b/src/lib/evas/cserve2/evas_cs2_client.c
@@ -1541,7 +1541,11 @@ _font_entry_glyph_map_rebuild_check(Font_Entry *fe, Font_Hint_Flags hints)
1541 gl = fash_gl_find(fe->fash[hints], gd->index); 1541 gl = fash_gl_find(fe->fash[hints], gd->index);
1542 if (gl && gl->base.bitmap.buffer) continue; 1542 if (gl && gl->base.bitmap.buffer) continue;
1543 1543
1544 if (!gl) gl = calloc(1, sizeof(*gl)); 1544 if (!gl)
1545 {
1546 gl = calloc(1, sizeof(*gl));
1547 eina_clist_element_init(&gl->map_entry);
1548 }
1545 gl->map = fe->map; 1549 gl->map = fe->map;
1546 gl->offset = gd->offset; 1550 gl->offset = gd->offset;
1547 gl->size = gd->size; 1551 gl->size = gd->size;
@@ -1555,7 +1559,8 @@ _font_entry_glyph_map_rebuild_check(Font_Entry *fe, Font_Hint_Flags hints)
1555 gl->idx = gd->index; 1559 gl->idx = gd->index;
1556 gl->rid = 0; 1560 gl->rid = 0;
1557 1561
1558 eina_clist_add_head(&fe->map->glyphs, &gl->map_entry); 1562 if (!eina_clist_element_is_linked(&gl->map_entry))
1563 eina_clist_add_head(&fe->map->glyphs, &gl->map_entry);
1559 fash_gl_add(fe->fash[hints], gd->index, gl); 1564 fash_gl_add(fe->fash[hints], gd->index, gl);
1560 cnt++; 1565 cnt++;
1561 } 1566 }
@@ -1676,8 +1681,12 @@ _glyph_request_cb(void *data, const void *msg, int size)
1676 1681
1677 if (gl->offset + glsize > (size_t) fe->map->mempool.size) 1682 if (gl->offset + glsize > (size_t) fe->map->mempool.size)
1678 { 1683 {
1679 ERR("Glyph is out of the buffer. Set buffer to NULL."); 1684 WRN("Glyph offset out of the buffer. Refreshing map.");
1680 gl->base.bitmap.buffer = NULL; 1685 if (!_glyph_map_remap_check(fe->map))
1686 {
1687 ERR("Failed to remap glyph mempool!");
1688 gl->base.bitmap.buffer = NULL;
1689 }
1681 } 1690 }
1682 1691
1683 eina_clist_add_head(&fe->map->glyphs, &gl->map_entry); 1692 eina_clist_add_head(&fe->map->glyphs, &gl->map_entry);
@@ -2017,7 +2026,7 @@ _server_index_list_set(Msg_Base *data, int size)
2017 2026
2018 if (_index.generation_id == msg->generation_id) 2027 if (_index.generation_id == msg->generation_id)
2019 { 2028 {
2020 ERR("New index generation_id is the same as before: %d", 2029 WRN("New index generation_id is the same as before: %d",
2021 _index.generation_id); 2030 _index.generation_id);
2022 } 2031 }
2023 2032