Commit b6f66cf9 authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

win32: add assertions for unchecked CoInitializeEx() calls

parent 86e1aff3
...@@ -409,7 +409,8 @@ static int CommonOpen( vlc_object_t *p_this, access_sys_t *p_sys, ...@@ -409,7 +409,8 @@ static int CommonOpen( vlc_object_t *p_this, access_sys_t *p_sys,
bool b_use_video = true; bool b_use_video = true;
/* Initialize OLE/COM */ /* Initialize OLE/COM */
CoInitializeEx( NULL, COINIT_APARTMENTTHREADED ); if( FAILED(CoInitializeEx( NULL, COINIT_APARTMENTTHREADED )) )
vlc_assert_unreachable();
var_Create( p_this, CFG_PREFIX "config", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); var_Create( p_this, CFG_PREFIX "config", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
var_Create( p_this, CFG_PREFIX "tuner", VLC_VAR_BOOL | VLC_VAR_DOINHERIT ); var_Create( p_this, CFG_PREFIX "tuner", VLC_VAR_BOOL | VLC_VAR_DOINHERIT );
......
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
# include <config.h> # include <config.h>
#endif #endif
#include <assert.h>
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_block.h> #include <vlc_block.h>
#include "dtv/bdagraph.hpp" #include "dtv/bdagraph.hpp"
...@@ -372,7 +374,8 @@ BDAGraph::BDAGraph( vlc_object_t *p_this ): ...@@ -372,7 +374,8 @@ BDAGraph::BDAGraph( vlc_object_t *p_this ):
p_scanning_tuner = NULL; p_scanning_tuner = NULL;
p_grabber = NULL; p_grabber = NULL;
CoInitializeEx( NULL, COINIT_APARTMENTTHREADED ); if( FAILED(CoInitializeEx( NULL, COINIT_APARTMENTTHREADED )) )
vlc_assert_unreachable();
} }
/***************************************************************************** /*****************************************************************************
......
...@@ -29,6 +29,8 @@ ...@@ -29,6 +29,8 @@
# include "config.h" # include "config.h"
#endif #endif
#include <assert.h>
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <vlc_codec.h> #include <vlc_codec.h>
...@@ -366,7 +368,8 @@ static int DecOpen( decoder_t *p_dec ) ...@@ -366,7 +368,8 @@ static int DecOpen( decoder_t *p_dec )
WAVEFORMATEX *p_wf = NULL; WAVEFORMATEX *p_wf = NULL;
/* Initialize OLE/COM */ /* Initialize OLE/COM */
CoInitializeEx( NULL, COINIT_APARTMENTTHREADED ); if( FAILED(CoInitializeEx( NULL, COINIT_APARTMENTTHREADED )) )
vlc_assert_unreachable();
if( LoadDMO( VLC_OBJECT(p_dec), &hmsdmo_dll, &p_dmo, &p_dec->fmt_in, false ) if( LoadDMO( VLC_OBJECT(p_dec), &hmsdmo_dll, &p_dmo, &p_dec->fmt_in, false )
!= VLC_SUCCESS ) != VLC_SUCCESS )
...@@ -1394,7 +1397,8 @@ static int EncOpen( vlc_object_t *p_this ) ...@@ -1394,7 +1397,8 @@ static int EncOpen( vlc_object_t *p_this )
HINSTANCE hmsdmo_dll = NULL; HINSTANCE hmsdmo_dll = NULL;
/* Initialize OLE/COM */ /* Initialize OLE/COM */
CoInitializeEx( NULL, COINIT_APARTMENTTHREADED ); if( FAILED(CoInitializeEx( NULL, COINIT_APARTMENTTHREADED )) )
vlc_assert_unreachable();
if( LoadDMO( p_this, &hmsdmo_dll, &p_dmo, &p_enc->fmt_out, true ) if( LoadDMO( p_this, &hmsdmo_dll, &p_dmo, &p_enc->fmt_out, true )
!= VLC_SUCCESS ) != VLC_SUCCESS )
......
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
# define STDCALL __stdcall # define STDCALL __stdcall
#endif #endif
#include <assert.h>
#include <vlc_common.h> #include <vlc_common.h>
#include <vlc_plugin.h> #include <vlc_plugin.h>
#include <vlc_codec.h> #include <vlc_codec.h>
...@@ -1121,7 +1123,8 @@ int Open(vlc_object_t *p_this) ...@@ -1121,7 +1123,8 @@ int Open(vlc_object_t *p_this)
if (!p_sys) if (!p_sys)
return VLC_ENOMEM; return VLC_ENOMEM;
CoInitializeEx(NULL, COINIT_MULTITHREADED); if( FAILED(CoInitializeEx(NULL, COINIT_MULTITHREADED)) )
vlc_assert_unreachable();
if (LoadMFTLibrary(&p_sys->mf_handle)) if (LoadMFTLibrary(&p_sys->mf_handle))
{ {
......
...@@ -44,6 +44,7 @@ ...@@ -44,6 +44,7 @@
#include <QSettings> #include <QSettings>
#include <QtAlgorithms> #include <QtAlgorithms>
#include <QDir> #include <QDir>
#include <assert.h>
#include <math.h> #include <math.h>
#define ICON_HEIGHT 48 #define ICON_HEIGHT 48
...@@ -1255,7 +1256,8 @@ void SPrefsPanel::assoDialog() ...@@ -1255,7 +1256,8 @@ void SPrefsPanel::assoDialog()
#endif /* __IApplicationAssociationRegistrationUI_INTERFACE_DEFINED__ */ #endif /* __IApplicationAssociationRegistrationUI_INTERFACE_DEFINED__ */
IApplicationAssociationRegistrationUI *p_appassoc; IApplicationAssociationRegistrationUI *p_appassoc;
CoInitializeEx( NULL, COINIT_MULTITHREADED ); if( FAILED(CoInitializeEx( NULL, COINIT_MULTITHREADED )) )
vlc_assert_unreachable();
if( S_OK == CoCreateInstance(CLSID_ApplicationAssociationRegistrationUI, if( S_OK == CoCreateInstance(CLSID_ApplicationAssociationRegistrationUI,
NULL, CLSCTX_INPROC_SERVER, NULL, CLSCTX_INPROC_SERVER,
......
...@@ -32,6 +32,8 @@ ...@@ -32,6 +32,8 @@
#include <QBitmap> #include <QBitmap>
#include <vlc_windows_interfaces.h> #include <vlc_windows_interfaces.h>
#include <assert.h>
#if defined(_WIN32) && HAS_QT5 #if defined(_WIN32) && HAS_QT5
# include <QWindow> # include <QWindow>
# include <qpa/qplatformnativeinterface.h> # include <qpa/qplatformnativeinterface.h>
...@@ -115,7 +117,8 @@ void MainInterface::createTaskBarButtons() ...@@ -115,7 +117,8 @@ void MainInterface::createTaskBarButtons()
FIXME:the play button's picture doesn't changed to pause when clicked FIXME:the play button's picture doesn't changed to pause when clicked
*/ */
CoInitializeEx( NULL, COINIT_MULTITHREADED ); if( FAILED(CoInitializeEx( NULL, COINIT_MULTITHREADED )) )
vlc_assert_unreachable();
if( S_OK == CoCreateInstance( CLSID_TaskbarList, if( S_OK == CoCreateInstance( CLSID_TaskbarList,
NULL, CLSCTX_INPROC_SERVER, NULL, CLSCTX_INPROC_SERVER,
......
...@@ -283,7 +283,8 @@ static void CommonChangeThumbnailClip(vout_display_t *vd, bool show) ...@@ -283,7 +283,8 @@ static void CommonChangeThumbnailClip(vout_display_t *vd, bool show)
if (!GetVersionEx(&winVer) || winVer.dwMajorVersion <= 5) if (!GetVersionEx(&winVer) || winVer.dwMajorVersion <= 5)
return; return;
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); if( FAILED(CoInitializeEx(NULL, COINIT_APARTMENTTHREADED)) )
vlc_assert_unreachable();
void *ptr; void *ptr;
if (S_OK == CoCreateInstance(&CLSID_TaskbarList, if (S_OK == CoCreateInstance(&CLSID_TaskbarList,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment