diff options
author | Thierry Bastian <thierry.bastian@nokia.com> | 2010-06-18 14:01:54 (GMT) |
---|---|---|
committer | Jason McDonald <jason.mcdonald@nokia.com> | 2010-06-21 10:37:10 (GMT) |
commit | 5a549780710cfb2e5110b068dd93f5a8393b0a86 (patch) | |
tree | ded0c008aa4ff33b8e05d0150dd0e02f21646f5e | |
parent | ef6d2ab56754eac8d65bc7a1c851a840f129fa87 (diff) | |
download | Qt-5a549780710cfb2e5110b068dd93f5a8393b0a86.zip Qt-5a549780710cfb2e5110b068dd93f5a8393b0a86.tar.gz Qt-5a549780710cfb2e5110b068dd93f5a8393b0a86.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
(cherry picked from commit cf5971503ee1f7a5ce96758e33796dfdf48375bf)
-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 |