diff options
author | wm4 <wm4@nowhere> | 2015-10-11 14:11:12 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-10-11 14:11:12 +0200 |
commit | b7ba2e2c578f9b7085adfc50d8db4b84183e8f2b (patch) | |
tree | 6a1278195723faf6c69061a21adac8e37d9f7fbc /DOCS/client_api_examples/qt_opengl/mpvwidget.cpp | |
parent | 52de5ea6addb62a89a79689397b055ba8fab1795 (diff) | |
download | mpv-b7ba2e2c578f9b7085adfc50d8db4b84183e8f2b.tar.bz2 mpv-b7ba2e2c578f9b7085adfc50d8db4b84183e8f2b.tar.xz |
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.
Diffstat (limited to 'DOCS/client_api_examples/qt_opengl/mpvwidget.cpp')
-rw-r--r-- | DOCS/client_api_examples/qt_opengl/mpvwidget.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/DOCS/client_api_examples/qt_opengl/mpvwidget.cpp b/DOCS/client_api_examples/qt_opengl/mpvwidget.cpp index 2f3bf7e200..16b800995c 100644 --- a/DOCS/client_api_examples/qt_opengl/mpvwidget.cpp +++ b/DOCS/client_api_examples/qt_opengl/mpvwidget.cpp @@ -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 |