mpv_gl: make GL current before freeing mpv render context
Drivers that enforce per-context GPU resource ownership (Mesa, Intel) leak textures and FBOs when mpv_render_context_free runs without the owning GL context current. NVIDIA tolerates this but others do not.
This commit is contained in:
parent
3d26e40e0f
commit
94a64dcd25
@ -113,7 +113,15 @@ class _MpvGLWidget(QWidget):
|
||||
|
||||
def cleanup(self) -> None:
|
||||
if self._ctx:
|
||||
# GL context must be current so mpv can release its textures
|
||||
# and FBOs on the correct context. Without this, drivers that
|
||||
# enforce per-context resource ownership (not NVIDIA, but
|
||||
# Mesa/Intel) leak the GPU objects.
|
||||
self._gl.makeCurrent()
|
||||
try:
|
||||
self._ctx.free()
|
||||
finally:
|
||||
self._gl.doneCurrent()
|
||||
self._ctx = None
|
||||
if self._mpv:
|
||||
self._mpv.terminate()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user