Skip to content

Commit

Permalink
Merge pull request #4 from adenexter/frame-ready-crash
Browse files Browse the repository at this point in the history
[nemo-qtmultimedia-plugins] Fix crash if plugin is destroyed in the fram...
  • Loading branch information
adenexter committed Jul 3, 2014
2 parents 29aa586 + 2d698cf commit 1b744b4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/videotexturebackend/videotexturebackend.cpp
Expand Up @@ -36,6 +36,7 @@
#include <QGuiApplication>
#include <QMediaObject>
#include <QMediaService>
#include <QMutex>
#include <QResizeEvent>
#include <QQuickWindow>
#include <QSGGeometry>
Expand Down Expand Up @@ -456,6 +457,7 @@ private slots:
private:
static void frame_ready(GstElement *sink, int frame, void *data);

QMutex m_mutex;
QPointer<QGStreamerElementControl> m_control;
GstElement *m_sink;
EGLDisplay m_display;
Expand Down Expand Up @@ -509,8 +511,11 @@ NemoVideoTextureBackend::~NemoVideoTextureBackend()
releaseControl();

if (m_sink) {
QMutexLocker locker(&m_mutex);

g_signal_handler_disconnect(G_OBJECT(m_sink), m_signalId);
gst_object_unref(GST_OBJECT(m_sink));
m_sink = 0;
}

if (m_texture) {
Expand Down Expand Up @@ -697,6 +702,12 @@ void NemoVideoTextureBackend::frame_ready(GstElement *, int frame, void *data)
if (frame < 0) {
instance->m_active = false;
} else {
QMutexLocker locker(&instance->m_mutex);

if (!instance->m_sink) {
return;
}

if (GstCaps *caps = gst_pad_get_negotiated_caps(
gst_element_get_static_pad(instance->m_sink, "sink"))) {
QSize textureSize;
Expand Down

0 comments on commit 1b744b4

Please sign in to comment.