From bf90f35302c319ec4699ccbcd1e28b15ef2ec423 Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Tue, 24 Jul 2018 18:00:14 -0700 Subject: [PATCH] [coretext] Add note --- src/hb-shaper-private.hh | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/hb-shaper-private.hh b/src/hb-shaper-private.hh index ce2d9f283..3fa532162 100644 --- a/src/hb-shaper-private.hh +++ b/src/hb-shaper-private.hh @@ -97,6 +97,10 @@ HB_SHAPER_DATA_ENSURE_FUNC(shaper, object) (hb_##object##_t *object) \ retry: \ HB_SHAPER_DATA_TYPE (shaper, object) *data = (HB_SHAPER_DATA_TYPE (shaper, object) *) hb_atomic_ptr_get (&HB_SHAPER_DATA (shaper, object)); \ if (likely (data) && !(condition)) { \ + /* Note that evaluating condition above can be dangerous if another thread + * got here first and destructed data. That's, as always, bad use pattern. + * If you modify the font (change font size), other threads must not be + * using it at the same time. */ /* Drop and recreate. */ \ /* If someone dropped it in the mean time, throw it away and don't touch it. \ * Otherwise, destruct it. */ \