Make lazy loader deal with OOM
This commit is contained in:
parent
30ff8ac865
commit
7df7963b46
|
@ -623,7 +623,11 @@ struct hb_lazy_loader_t
|
||||||
if (unlikely (!p))
|
if (unlikely (!p))
|
||||||
{
|
{
|
||||||
hb_face_t *face = *(((hb_face_t **) this) - WheresFace);
|
hb_face_t *face = *(((hb_face_t **) this) - WheresFace);
|
||||||
p = thiz ()->create (face);
|
if (likely (!p))
|
||||||
|
p = thiz ()->create (face);
|
||||||
|
if (unlikely (!p))
|
||||||
|
p = thiz ()->create (nullptr); /* Produce nil object. */
|
||||||
|
assert (p);
|
||||||
if (unlikely (!hb_atomic_ptr_cmpexch (const_cast<Stored **>(&this->instance), nullptr, p)))
|
if (unlikely (!hb_atomic_ptr_cmpexch (const_cast<Stored **>(&this->instance), nullptr, p)))
|
||||||
{
|
{
|
||||||
thiz ()->destroy (p);
|
thiz ()->destroy (p);
|
||||||
|
|
Loading…
Reference in New Issue