gtkglsink: Don't leak vertex array and buffers

This is now possible since reset is always called from the
main thread.

https://bugzilla.gnome.org/show_bug.cgi?id=752441
This commit is contained in:
Nicolas Dufresne 2015-07-17 15:08:53 -04:00
parent 410ffd5c62
commit 5e87b9f9af

View file

@ -360,6 +360,26 @@ _reset (GtkGstBaseWidget * base_widget)
!base_widget->ignore_alpha); !base_widget->ignore_alpha);
} }
/* called from main thread */
static void
gtk_gst_gl_widget_reset (GtkGstBaseWidget * base_widget)
{
GtkGstGLWidgetPrivate *priv = GTK_GST_GL_WIDGET (base_widget)->priv;
const GstGLFuncs *gl = priv->other_context->gl_vtable;
_reset (base_widget);
if (priv->vao) {
gl->DeleteVertexArrays (1, &priv->vao);
priv->vao = 0;
}
if (priv->vertex_buffer) {
gl->DeleteBuffers (1, &priv->vertex_buffer);
priv->vertex_buffer = 0;
}
}
static void static void
gtk_gst_gl_widget_finalize (GObject * object) gtk_gst_gl_widget_finalize (GObject * object)
{ {
@ -393,7 +413,7 @@ gtk_gst_gl_widget_class_init (GtkGstGLWidgetClass * klass)
gobject_klass->finalize = gtk_gst_gl_widget_finalize; gobject_klass->finalize = gtk_gst_gl_widget_finalize;
gl_widget_klass->render = gtk_gst_gl_widget_render; gl_widget_klass->render = gtk_gst_gl_widget_render;
base_widget_klass->reset = _reset; base_widget_klass->reset = gtk_gst_gl_widget_reset;
} }
static void static void