qml: reuse existing GstQSGTexture
authorRoman Nowicki <rnowicki@sims.pl>
Fri, 20 Nov 2015 00:18:43 +0000 (11:18 +1100)
committerMatthew Waters <matthew@centricular.com>
Fri, 20 Nov 2015 00:18:43 +0000 (11:18 +1100)
Fixes a memory leak leaking the texture objects.

https://bugzilla.gnome.org/show_bug.cgi?id=758286

ext/qt/qtitem.cc

index ec2e859..ca8e535 100644 (file)
@@ -205,12 +205,12 @@ QtGLVideoItem::updatePaintNode(QSGNode * oldNode,
   if (!texNode) {
     texNode = new QSGSimpleTextureNode ();
     texNode->setOwnsTexture (true);
+    texNode->setTexture (new GstQSGTexture ());
   }
 
-  tex = new GstQSGTexture ();
+  tex = static_cast<GstQSGTexture *> (texNode->texture());
   tex->setCaps (this->priv->caps);
   tex->setBuffer (this->priv->buffer);
-  texNode->setTexture (tex);
 
   if (this->priv->force_aspect_ratio) {
     src.w = this->priv->display_width;