Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Unified Diff: third_party/harfbuzz-ng/src/hb-shape-plan.cc

Issue 202083003: Fix unsafe shape_plan->face dependency (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/harfbuzz-ng/src/hb-shape-plan.cc
diff --git a/third_party/harfbuzz-ng/src/hb-shape-plan.cc b/third_party/harfbuzz-ng/src/hb-shape-plan.cc
index b44a9e2ab77ed4d6958ce2c4bfb09ded5f992183..13544056d722410f89b7e14a05d3632082b39fb6 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);
}
« no previous file with comments | « third_party/harfbuzz-ng/src/hb-ot-shape-private.hh ('k') | third_party/harfbuzz-ng/src/hb-shape-plan-private.hh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698