diff --git a/src/plugins/directshow/player/directshowvideorenderercontrol.cpp b/src/plugins/directshow/player/directshowvideorenderercontrol.cpp index da476488..6a1580ea 100644 --- a/src/plugins/directshow/player/directshowvideorenderercontrol.cpp +++ b/src/plugins/directshow/player/directshowvideorenderercontrol.cpp @@ -45,7 +45,8 @@ DirectShowVideoRendererControl::DirectShowVideoRendererControl(DirectShowEventLo DirectShowVideoRendererControl::~DirectShowVideoRendererControl() { - delete m_filter; + if (m_filter) + m_filter->Release(); } QAbstractVideoSurface *DirectShowVideoRendererControl::surface() const @@ -68,7 +69,8 @@ void DirectShowVideoRendererControl::setSurface(QAbstractVideoSurface *surface) emit filterChanged(); - delete existingFilter; + if (existingFilter) + existingFilter->Release(); } } diff --git a/src/plugins/directshow/player/videosurfacefilter.cpp b/src/plugins/directshow/player/videosurfacefilter.cpp index 901d2e90..1fa7329c 100644 --- a/src/plugins/directshow/player/videosurfacefilter.cpp +++ b/src/plugins/directshow/player/videosurfacefilter.cpp @@ -69,7 +69,7 @@ VideoSurfaceFilter::VideoSurfaceFilter( VideoSurfaceFilter::~VideoSurfaceFilter() { - Q_ASSERT(m_ref == 1); + Q_ASSERT(m_ref == 0); } HRESULT VideoSurfaceFilter::QueryInterface(REFIID riid, void **ppvObject) @@ -110,8 +110,8 @@ ULONG VideoSurfaceFilter::AddRef() ULONG VideoSurfaceFilter::Release() { ULONG ref = InterlockedDecrement(&m_ref); - - Q_ASSERT(ref != 0); + if (ref == 0) + delete this; return ref; }