Fix crash when using large number of different fonts
QCDistanceFieldGlyphCache keeps a QCRhiDistanceFieldGlyphCache for
every font used. QCRhiDistanceFieldGlyphCache would keep a
QRhiResourceUpdateBatch allocated at all times. However the
number of update batches has a hard limit of 64 for the whole
QRhi instance, and nextResourceUpdateBatch() will return nullptr
if this limit is exeeded. This patch does two things:
1. Add nullptr guards to avoid crashing if m_batch is nullptr.
2. Allocate m_batch lazily instead of in the constructor.
Pick-to: 6.12
Change-Id: Ie96d553c8250917f7bd4adce2f30fc0fd4f7732b
Reviewed-by: Owais Akhtar <owais.akhtar@qt.io>
Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>