summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwangxianzhu@chromium.org <wangxianzhu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-19 18:43:47 +0000
committerwangxianzhu@chromium.org <wangxianzhu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-03-19 18:43:47 +0000
commit61049743f9b8804fbe1c6a756805b8da57eec381 (patch)
tree263d51d8146d9234fc2f6165079c54397d382466
parent42f5ffa03b9525d9c0e06b515770176530ea42ca (diff)
downloadchromium_src-61049743f9b8804fbe1c6a756805b8da57eec381.zip
chromium_src-61049743f9b8804fbe1c6a756805b8da57eec381.tar.gz
chromium_src-61049743f9b8804fbe1c6a756805b8da57eec381.tar.bz2
Merge 257509 "Fix unsafe shape_plan->face dependency"
> Fix unsafe shape_plan->face dependency > > This cherry-picks http://cgit.freedesktop.org/harfbuzz/commit/src?id=f47b9219546edcfdeb3991ee27f6d9ba455c3e08 > > BUG=335156 > TBR=eae@chromium.org > > Review URL: https://codereview.chromium.org/202083003 TBR=wangxianzhu@chromium.org Review URL: https://codereview.chromium.org/203543007 git-svn-id: svn://svn.chromium.org/chrome/branches/1847/src@258047 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--third_party/harfbuzz-ng/src/hb-ot-shape-private.hh2
-rw-r--r--third_party/harfbuzz-ng/src/hb-shape-plan-private.hh2
-rw-r--r--third_party/harfbuzz-ng/src/hb-shape-plan.cc11
3 files changed, 5 insertions, 10 deletions
diff --git a/third_party/harfbuzz-ng/src/hb-ot-shape-private.hh b/third_party/harfbuzz-ng/src/hb-ot-shape-private.hh
index 8171471..cbfab5b 100644
--- a/third_party/harfbuzz-ng/src/hb-ot-shape-private.hh
+++ b/third_party/harfbuzz-ng/src/hb-ot-shape-private.hh
@@ -66,7 +66,7 @@ struct hb_ot_shape_planner_t
hb_ot_map_builder_t map;
hb_ot_shape_planner_t (const hb_shape_plan_t *master_plan) :
- face (master_plan->face),
+ face (master_plan->face_unsafe),
props (master_plan->props),
shaper (NULL),
map (face, &props) {}
diff --git a/third_party/harfbuzz-ng/src/hb-shape-plan-private.hh b/third_party/harfbuzz-ng/src/hb-shape-plan-private.hh
index dd014e3..adb1576 100644
--- a/third_party/harfbuzz-ng/src/hb-shape-plan-private.hh
+++ b/third_party/harfbuzz-ng/src/hb-shape-plan-private.hh
@@ -39,7 +39,7 @@ struct hb_shape_plan_t
ASSERT_POD ();
hb_bool_t default_shaper_list;
- hb_face_t *face;
+ hb_face_t *face_unsafe; /* We don't carry a reference to face. */
hb_segment_properties_t props;
hb_shape_func_t *shaper_func;
diff --git a/third_party/harfbuzz-ng/src/hb-shape-plan.cc b/third_party/harfbuzz-ng/src/hb-shape-plan.cc
index b44a9e2..1354405 100644
--- a/third_party/harfbuzz-ng/src/hb-shape-plan.cc
+++ b/third_party/harfbuzz-ng/src/hb-shape-plan.cc
@@ -46,7 +46,7 @@ hb_shape_plan_plan (hb_shape_plan_t *shape_plan,
#define HB_SHAPER_PLAN(shaper) \
HB_STMT_START { \
- if (hb_##shaper##_shaper_face_data_ensure (shape_plan->face)) { \
+ if (hb_##shaper##_shaper_face_data_ensure (shape_plan->face_unsafe)) { \
HB_SHAPER_DATA (shaper, shape_plan) = \
HB_SHAPER_DATA_CREATE_FUNC (shaper, shape_plan) (shape_plan, user_features, num_user_features); \
shape_plan->shaper_func = _hb_##shaper##_shape; \
@@ -117,7 +117,7 @@ hb_shape_plan_create (hb_face_t *face,
hb_face_make_immutable (face);
shape_plan->default_shaper_list = shaper_list == NULL;
- shape_plan->face = hb_face_reference (face);
+ shape_plan->face_unsafe = face;
shape_plan->props = *props;
hb_shape_plan_plan (shape_plan, user_features, num_user_features, shaper_list);
@@ -190,8 +190,6 @@ hb_shape_plan_destroy (hb_shape_plan_t *shape_plan)
#include "hb-shaper-list.hh"
#undef HB_SHAPER_IMPLEMENT
- hb_face_destroy (shape_plan->face);
-
free (shape_plan);
}
@@ -264,7 +262,7 @@ hb_shape_plan_execute (hb_shape_plan_t *shape_plan,
hb_object_is_inert (buffer)))
return false;
- assert (shape_plan->face == font->face);
+ assert (shape_plan->face_unsafe == font->face);
assert (hb_segment_properties_equal (&shape_plan->props, &buffer->props));
#define HB_SHAPER_EXECUTE(shaper) \
@@ -395,9 +393,6 @@ retry:
goto retry;
}
- /* Release our reference on face. */
- hb_face_destroy (face);
-
return hb_shape_plan_reference (shape_plan);
}