Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge branch 'master' into 'master'
[nemo-qtmultimedia-plugins] Fix crash when the scene graph is invalidated. Fixes JB#31414

We must make sure the old sync object is not used when we start rendering
again, when it's not valid anymore.

See merge request !1
  • Loading branch information
foolab committed Nov 6, 2015
2 parents 3ee1e77 + d8191d3 commit fd04565
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/videotexturebackend/videotexturebackend.cpp
Expand Up @@ -77,6 +77,7 @@ class GStreamerVideoTexture : public QSGDynamicTexture
bool updateTexture();

void invalidateTexture();
void invalidated();

public slots:
void releaseTexture();
Expand Down Expand Up @@ -285,6 +286,20 @@ void GStreamerVideoTexture::releaseTexture()
}
}

void GStreamerVideoTexture::invalidated()
{
NemoGstVideoTexture *sink = NEMO_GST_VIDEO_TEXTURE(m_sink);

nemo_gst_video_texture_unbind_frame(sink);

if (m_textureId) {
glDeleteTextures(1, &m_textureId);
m_textureId = 0;
}

nemo_gst_video_texture_release_frame(sink, NULL);
}

class GStreamerVideoMaterialShader : public QSGMaterialShader
{
public:
Expand Down Expand Up @@ -650,6 +665,8 @@ QSGNode *NemoVideoTextureBackend::updatePaintNode(QSGNode *oldNode, QQuickItem::
connect(q->window(), SIGNAL(afterRendering()),
m_texture, SLOT(releaseTexture()),
Qt::DirectConnection);
connect(q->window(), &QQuickWindow::sceneGraphInvalidated, m_texture,
&GStreamerVideoTexture::invalidated, Qt::DirectConnection);
}
m_texture->setTextureSize(m_textureSize);

Expand Down

0 comments on commit fd04565

Please sign in to comment.