Caused crashes like the one William was fixing in the D12498, or the
crash when rendering multiple view layers.
Need to guarantee that the render engine is not freed during drawing,
and that the external engine is not in the middle of re-allocation due
to update() which might cause session reset (happens in Cycles).
Had to introduce a separate lock. The reason for this comes from the
fact that we need to acquire the engine early on in the draw manager,
and release it only when drawing is done. However, some other engines
(like overlay) might be requesting ImBuf for the image space, so that
they know dimensions. Such acquisition is guarded by the resultmutex.
This means reusing resultmutex for the RenderEngine::draw() would
cause a recursive lock.
Not entirely happy with implicit release in the external engine code,
but not sure there is an existing way of making it explicit without
introducing new draw engine callback.