X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fhb-graphite2.cc;h=c20f6bef2d81d11f96ac53459b2ac75b8a0f3aa2;hb=b9f425ddd6223cd82b3d35f13fbd060d3c0c0e38;hp=46fe13999130e8e2c0ca56ae1f7adff9f6d9d26e;hpb=1c272a48507bb3c7905aa30d8bf0d092b474f781;p=platform%2Fupstream%2Fharfbuzz.git diff --git a/src/hb-graphite2.cc b/src/hb-graphite2.cc index 46fe139..c20f6be 100644 --- a/src/hb-graphite2.cc +++ b/src/hb-graphite2.cc @@ -79,10 +79,12 @@ static const void *hb_graphite2_get_table (const void *data, unsigned int tag, s p->blob = blob; p->tag = tag; - /* TODO Not thread-safe, but fairly harmless. - * We can do the double-checked pointer cmpexch thing here. */ - p->next = face_data->tlist; - face_data->tlist = p; +retry: + hb_graphite2_tablelist_t *tlist = (hb_graphite2_tablelist_t *) hb_atomic_ptr_get (&face_data->tlist); + p->next = tlist; + + if (!hb_atomic_ptr_cmpexch (&face_data->tlist, tlist, p)) + goto retry; } unsigned int tlen; @@ -381,11 +383,11 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan, pPos->x_offset = gr_slot_origin_X (is) * xscale - curradvx; pPos->y_offset = gr_slot_origin_Y (is) * yscale - curradvy; if (info->cluster != currclus) { - pPos->x_advance = info->var1.i32 * xscale; - curradvx += pPos->x_advance; - currclus = info->cluster; + pPos->x_advance = info->var1.i32 * xscale; + curradvx += pPos->x_advance; + currclus = info->cluster; } else - pPos->x_advance = 0.; + pPos->x_advance = 0.; pPos->y_advance = gr_slot_advance_Y (is, grface, nullptr) * yscale; curradvy += pPos->y_advance; @@ -398,11 +400,11 @@ _hb_graphite2_shape (hb_shape_plan_t *shape_plan, { if (info->cluster != currclus) { - pPos->x_advance = info->var1.i32 * xscale; - curradvx -= pPos->x_advance; - currclus = info->cluster; + pPos->x_advance = info->var1.i32 * xscale; + curradvx -= pPos->x_advance; + currclus = info->cluster; } else - pPos->x_advance = 0.; + pPos->x_advance = 0.; pPos->y_advance = gr_slot_advance_Y (is, grface, nullptr) * yscale; curradvy -= pPos->y_advance;