diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2010-06-18 14:01:54 (GMT) |
---|---|---|
committer | Thierry Bastian <thierry.bastian@nokia.com> | 2010-06-18 14:08:29 (GMT) |
commit | cf5971503ee1f7a5ce96758e33796dfdf48375bf (patch) | |
tree | 11da7a53f7684966d285ad806f82a777020bd008 /src/3rdparty | |
parent | 5aa218df32ec026ad549e524b4ad49799eef9465 (diff) | |
download | Qt-cf5971503ee1f7a5ce96758e33796dfdf48375bf.zip Qt-cf5971503ee1f7a5ce96758e33796dfdf48375bf.tar.gz Qt-cf5971503ee1f7a5ce96758e33796dfdf48375bf.tar.bz2 |
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
Diffstat (limited to 'src/3rdparty')
-rw-r--r-- | src/3rdparty/phonon/ds9/videorenderer_evr.cpp | 16 |
1 files 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<T> ret; ComPointer<IMFGetService> getService(filter, IID_IMFGetService); - Q_ASSERT(getService); - T *ptr = 0; - HRESULT hr = getService->GetService(guidService, riid, reinterpret_cast<void **>(&ptr)); - if (!SUCCEEDED(hr) || ptr == 0) - Q_ASSERT(!SUCCEEDED(hr) && ptr != 0); - ComPointer<T> service(ptr); - return service; + if (getService) { + getService->GetService(guidService, riid, reinterpret_cast<void**>(ret.pparam())); + } + return ret; } VideoRendererEVR::~VideoRendererEVR() @@ -70,6 +68,10 @@ namespace Phonon } ComPointer<IMFVideoDisplayControl> filterControl = getService<IMFVideoDisplayControl>(m_filter, MR_VIDEO_RENDER_SERVICE, IID_IMFVideoDisplayControl); + if (!filterControl) { + m_filter = Filter(); //will release the interface + return; + } filterControl->SetVideoWindow(reinterpret_cast<HWND>(target->winId())); filterControl->SetAspectRatioMode(MFVideoARMode_None); // We're in control of the size |