Skip to content

Commit ee1dfa0

Browse files
nimrod-gileadicopybara-github
authored andcommitted
Free the GL context when OffScreenRenderer.release() is called.
After the previous change, the surface would only be released if there was an active MjrContext. This seems to be the case in practice, but it since it's possible for OffScreenRenderer to exist without an active MjrContext (before rendering), it makes sense to manage the GL context separately. PiperOrigin-RevId: 435647965 Change-Id: I58da564dc4a7e04d77a2652c7511f03351fb84c6
1 parent 469a8bd commit ee1dfa0

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

dm_control/viewer/renderer.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,8 +173,10 @@ def release(self):
173173
if self._mujoco_context:
174174
self._mujoco_context.free()
175175
self._mujoco_context = None
176+
if self._surface:
176177
self._surface.decrement_refcount()
177178
self._surface.free()
179+
self._surface = None
178180

179181
@property
180182
def pixels(self):

0 commit comments

Comments
 (0)