diff --git a/src/hb-shaper-private.hh b/src/hb-shaper-private.hh index 9d30c1ea0..29c449394 100644 --- a/src/hb-shaper-private.hh +++ b/src/hb-shaper-private.hh @@ -95,7 +95,10 @@ hb_##shaper##_shaper_##object##_data_ensure (hb_##object##_t *object) \ if (unlikely (!data)) \ data = (HB_SHAPER_DATA_TYPE (shaper, object) *) HB_SHAPER_DATA_INVALID; \ if (!hb_atomic_ptr_cmpexch (&HB_SHAPER_DATA (shaper, object), NULL, data)) { \ - HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (data); \ + if (data && \ + data != HB_SHAPER_DATA_INVALID && \ + data != HB_SHAPER_DATA_SUCCEEDED) \ + HB_SHAPER_DATA_DESTROY_FUNC (shaper, object) (data); \ goto retry; \ } \ } \