Fix a few memory leaks.

XV Buffer pool was leaking, the sink delegate was leaking, and the
sink wasn't chaining to parent class so GstObject stuff was leaking.

Change-Id: I5d6b6fe59dfb2b3c5367dfde8331e5943167b55d
Reviewed-by: Dmytro Poplavskiy <dmytro.poplavskiy@nokia.com>
This commit is contained in:
Michael Goddard
2012-03-05 19:01:02 +10:00
committed by Qt by Nokia
parent 0ae0ad6468
commit 34f2494df1

View File

@@ -78,7 +78,7 @@ QVideoSurfaceGstDelegate::QVideoSurfaceGstDelegate(
} }
} }
#ifdef HAVE_XVIDEO #ifdef HAVE_XVIDEO
m_pools.append(new QGstXvImageBufferPool()); m_pools.append(new QGstXvImageBufferPool(this));
#endif #endif
updateSupportedFormats(); updateSupportedFormats();
connect(m_surface, SIGNAL(supportedFormatsChanged()), this, SLOT(updateSupportedFormats())); connect(m_surface, SIGNAL(supportedFormatsChanged()), this, SLOT(updateSupportedFormats()));
@@ -87,7 +87,6 @@ QVideoSurfaceGstDelegate::QVideoSurfaceGstDelegate(
QVideoSurfaceGstDelegate::~QVideoSurfaceGstDelegate() QVideoSurfaceGstDelegate::~QVideoSurfaceGstDelegate()
{ {
qDeleteAll(m_pools);
setLastPrerolledBuffer(0); setLastPrerolledBuffer(0);
} }
@@ -502,6 +501,11 @@ void QVideoSurfaceGstSink::finalize(GObject *object)
if (sink->lastRequestedCaps) if (sink->lastRequestedCaps)
gst_caps_unref(sink->lastRequestedCaps); gst_caps_unref(sink->lastRequestedCaps);
sink->lastRequestedCaps = 0; sink->lastRequestedCaps = 0;
delete sink->delegate;
// Chain up
G_OBJECT_CLASS(sink_parent_class)->finalize(object);
} }
GstStateChangeReturn QVideoSurfaceGstSink::change_state( GstStateChangeReturn QVideoSurfaceGstSink::change_state(