From cf5971503ee1f7a5ce96758e33796dfdf48375bf Mon Sep 17 00:00:00 2001 From: Thierry Bastian Date: Fri, 18 Jun 2010 16:01:54 +0200 Subject: Fix a possible crash with the EVR video renderer in windows This can happn when the component can be instanciated but not all the services are available on it. The code is now more robust. Reviewed-By: gabi --- src/3rdparty/phonon/ds9/videorenderer_evr.cpp | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/src/3rdparty/phonon/ds9/videorenderer_evr.cpp b/src/3rdparty/phonon/ds9/videorenderer_evr.cpp index d23d9ce..de3f46f 100644 --- a/src/3rdparty/phonon/ds9/videorenderer_evr.cpp +++ b/src/3rdparty/phonon/ds9/videorenderer_evr.cpp @@ -43,14 +43,12 @@ namespace Phonon { //normally we should use IID_IMFGetService but this introduces another dependency //so here we simply define our own IId with the same value + ComPointer ret; ComPointer getService(filter, IID_IMFGetService); - Q_ASSERT(getService); - T *ptr = 0; - HRESULT hr = getService->GetService(guidService, riid, reinterpret_cast(&ptr)); - if (!SUCCEEDED(hr) || ptr == 0) - Q_ASSERT(!SUCCEEDED(hr) && ptr != 0); - ComPointer service(ptr); - return service; + if (getService) { + getService->GetService(guidService, riid, reinterpret_cast(ret.pparam())); + } + return ret; } VideoRendererEVR::~VideoRendererEVR() @@ -70,6 +68,10 @@ namespace Phonon } ComPointer filterControl = getService(m_filter, MR_VIDEO_RENDER_SERVICE, IID_IMFVideoDisplayControl); + if (!filterControl) { + m_filter = Filter(); //will release the interface + return; + } filterControl->SetVideoWindow(reinterpret_cast(target->winId())); filterControl->SetAspectRatioMode(MFVideoARMode_None); // We're in control of the size -- cgit v0.12