mirror of
https://github.com/mpv-player/mpv
synced 2025-02-08 07:57:19 +00:00
DOCS/client_api_examples/qt_opengl: fix uninit
mpv_opengl_cb_uninit_gl() still needs the OpenGL context. It makes calls to free OpenGL objects. Strictly speaking, this is probably unnecessary, because the OpenGL context is destroyed afterwards (implicitly freeing all related objects). But mpv_opengl_cb_uninit_gl() does not require the destruction of the OpenGL context, and thus has to free resources manually. It's also true that OpenGL normally simply ignores API calls (or returns errors) if no context is set, but doing it properly is cleaner. That makeCurrent() can be called in the destructor is explicitly allowed and recommended for freeing GL resources in the Qt docs. This fixes a mpv error message on exit.
This commit is contained in:
parent
52de5ea6ad
commit
b7ba2e2c57
@ -47,6 +47,7 @@ MpvWidget::MpvWidget(QWidget *parent, Qt::WindowFlags f)
|
||||
|
||||
MpvWidget::~MpvWidget()
|
||||
{
|
||||
makeCurrent();
|
||||
if (mpv_gl)
|
||||
mpv_opengl_cb_set_update_callback(mpv_gl, NULL, NULL);
|
||||
// Until this call is done, we need to make sure the player remains
|
||||
|
Loading…
Reference in New Issue
Block a user