Fix #145743: EEVEE: Instance leak when Stereoscopy is enabled

The `eevee_render_to_image` can be called multiple time in the
case of multiview rendering.

To avoid the leak, free the previous instance before allocating
the new one. Reusing the instance doesn't seems to work here.

Another fix will follow this one to fix it more gracefuly.
This fix is kept simple for backporting purpose.

Pull Request: https://projects.blender.org/blender/blender/pulls/146015
This commit is contained in:
Clément Foucault
2025-09-10 12:18:49 +02:00
committed by Clément Foucault
parent b3dec6617a
commit f0806ac6b4

View File

@@ -45,6 +45,8 @@ static void eevee_render(RenderEngine *engine, Depsgraph *depsgraph)
const char *viewname = RE_GetActiveRenderView(engine->re);
int size[2] = {engine->resolution_x, engine->resolution_y};
/* Avoid leaking in the case of multiview. (see #145743) */
delete instance;
/* WORKAROUND: Fails if created in the parent scope. Must be because of lack of active
* `DRWContext`. To be revisited. */
instance = new Instance();