Skip to content

Commit

Permalink
[nemo-qtmultimedia-plugins] Fix crash when the scene graph is invalid…
Browse files Browse the repository at this point in the history
…ated. 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.
  • Loading branch information
giucam committed Nov 5, 2015
1 parent 3ee1e77 commit d8191d3
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 d8191d3

Please sign in to comment.