DirectShow: fix custom renderer reference counting.
Change-Id: Iadefd4d72bdafb982a79b99ee5880dba32f3e920 Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
This commit is contained in:
@@ -45,7 +45,8 @@ DirectShowVideoRendererControl::DirectShowVideoRendererControl(DirectShowEventLo
|
|||||||
|
|
||||||
DirectShowVideoRendererControl::~DirectShowVideoRendererControl()
|
DirectShowVideoRendererControl::~DirectShowVideoRendererControl()
|
||||||
{
|
{
|
||||||
delete m_filter;
|
if (m_filter)
|
||||||
|
m_filter->Release();
|
||||||
}
|
}
|
||||||
|
|
||||||
QAbstractVideoSurface *DirectShowVideoRendererControl::surface() const
|
QAbstractVideoSurface *DirectShowVideoRendererControl::surface() const
|
||||||
@@ -68,7 +69,8 @@ void DirectShowVideoRendererControl::setSurface(QAbstractVideoSurface *surface)
|
|||||||
|
|
||||||
emit filterChanged();
|
emit filterChanged();
|
||||||
|
|
||||||
delete existingFilter;
|
if (existingFilter)
|
||||||
|
existingFilter->Release();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ VideoSurfaceFilter::VideoSurfaceFilter(
|
|||||||
|
|
||||||
VideoSurfaceFilter::~VideoSurfaceFilter()
|
VideoSurfaceFilter::~VideoSurfaceFilter()
|
||||||
{
|
{
|
||||||
Q_ASSERT(m_ref == 1);
|
Q_ASSERT(m_ref == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
HRESULT VideoSurfaceFilter::QueryInterface(REFIID riid, void **ppvObject)
|
HRESULT VideoSurfaceFilter::QueryInterface(REFIID riid, void **ppvObject)
|
||||||
@@ -110,8 +110,8 @@ ULONG VideoSurfaceFilter::AddRef()
|
|||||||
ULONG VideoSurfaceFilter::Release()
|
ULONG VideoSurfaceFilter::Release()
|
||||||
{
|
{
|
||||||
ULONG ref = InterlockedDecrement(&m_ref);
|
ULONG ref = InterlockedDecrement(&m_ref);
|
||||||
|
if (ref == 0)
|
||||||
Q_ASSERT(ref != 0);
|
delete this;
|
||||||
|
|
||||||
return ref;
|
return ref;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user