Fix BSTR leaks in wxAMMediaBackend and wxWMP10MediaBackend.
This commit is contained in:
@@ -1127,7 +1127,7 @@ bool wxAMMediaBackend::Load(const wxURI& location, const wxURI& proxy)
|
||||
if(pPlay)
|
||||
{
|
||||
pPlay->put_UseHTTPProxy(VARIANT_TRUE);
|
||||
pPlay->put_HTTPProxyHost(wxBasicString(proxy.GetServer()).Detach());
|
||||
pPlay->put_HTTPProxyHost(wxBasicString(proxy.GetServer()));
|
||||
pPlay->put_HTTPProxyPort(wxAtoi(proxy.GetPort()));
|
||||
pPlay->Release();
|
||||
}
|
||||
@@ -1150,9 +1150,9 @@ bool wxAMMediaBackend::DoLoad(const wxString& location)
|
||||
// the docs say its async and put_FileName is not -
|
||||
// but in practice they both seem to be async anyway
|
||||
if(GetMP())
|
||||
hr = GetMP()->Open( wxBasicString(location).Detach() );
|
||||
hr = GetMP()->Open( wxBasicString(location) );
|
||||
else
|
||||
hr = GetAM()->put_FileName( wxBasicString(location).Detach() );
|
||||
hr = GetAM()->put_FileName( wxBasicString(location) );
|
||||
|
||||
if(FAILED(hr))
|
||||
{
|
||||
|
@@ -905,21 +905,21 @@ bool wxWMP10MediaBackend::Load(const wxURI& location,
|
||||
{
|
||||
long lOldSetting;
|
||||
if( pWMPNetwork->getProxySettings(
|
||||
wxBasicString(location.GetScheme()).Get(), &lOldSetting
|
||||
wxBasicString(location.GetScheme()), &lOldSetting
|
||||
) == 0 &&
|
||||
|
||||
pWMPNetwork->setProxySettings(
|
||||
wxBasicString(location.GetScheme()).Detach(), // protocol
|
||||
wxBasicString(location.GetScheme()), // protocol
|
||||
2) == 0) // 2 == manually specify
|
||||
{
|
||||
BSTR bsOldName = NULL;
|
||||
wxBasicString bsOldName;
|
||||
long lOldPort = 0;
|
||||
|
||||
pWMPNetwork->getProxyName(
|
||||
wxBasicString(location.GetScheme()).Detach(),
|
||||
&bsOldName);
|
||||
wxBasicString(location.GetScheme()),
|
||||
bsOldName.ByRef());
|
||||
pWMPNetwork->getProxyPort(
|
||||
wxBasicString(location.GetScheme()).Detach(),
|
||||
wxBasicString(location.GetScheme()),
|
||||
&lOldPort);
|
||||
|
||||
long lPort;
|
||||
@@ -936,11 +936,11 @@ bool wxWMP10MediaBackend::Load(const wxURI& location,
|
||||
}
|
||||
|
||||
if( pWMPNetwork->setProxyName(
|
||||
wxBasicString(location.GetScheme()).Detach(), // proto
|
||||
wxBasicString(server).Get() ) == 0 &&
|
||||
wxBasicString(location.GetScheme()), // proto
|
||||
wxBasicString(server) ) == 0 &&
|
||||
|
||||
pWMPNetwork->setProxyPort(
|
||||
wxBasicString(location.GetScheme()).Detach(), // proto
|
||||
wxBasicString(location.GetScheme()), // proto
|
||||
lPort
|
||||
) == 0
|
||||
)
|
||||
@@ -948,16 +948,16 @@ bool wxWMP10MediaBackend::Load(const wxURI& location,
|
||||
bOK = DoLoad(location.BuildURI());
|
||||
|
||||
pWMPNetwork->setProxySettings(
|
||||
wxBasicString(location.GetScheme()).Detach(), // protocol
|
||||
wxBasicString(location.GetScheme()), // protocol
|
||||
lOldSetting);
|
||||
if(bsOldName)
|
||||
pWMPNetwork->setProxyName(
|
||||
wxBasicString(location.GetScheme()).Detach(), // protocol
|
||||
wxBasicString(location.GetScheme()), // protocol
|
||||
bsOldName);
|
||||
|
||||
if(lOldPort)
|
||||
pWMPNetwork->setProxyPort(
|
||||
wxBasicString(location.GetScheme()).Detach(), // protocol
|
||||
wxBasicString(location.GetScheme()), // protocol
|
||||
lOldPort);
|
||||
|
||||
pWMPNetwork->Release();
|
||||
@@ -997,7 +997,7 @@ bool wxWMP10MediaBackend::DoLoad(const wxString& location)
|
||||
{
|
||||
IWMPMedia* pWMPMedia;
|
||||
|
||||
if( (hr = pWMPCore3->newMedia(wxBasicString(location).Get(),
|
||||
if( (hr = pWMPCore3->newMedia(wxBasicString(location),
|
||||
&pWMPMedia)) == 0)
|
||||
{
|
||||
// this (get_duration) will actually FAIL, but it will work.
|
||||
@@ -1012,7 +1012,7 @@ bool wxWMP10MediaBackend::DoLoad(const wxString& location)
|
||||
#endif
|
||||
{
|
||||
// just load it the "normal" way
|
||||
hr = m_pWMPPlayer->put_URL( wxBasicString(location).Detach() );
|
||||
hr = m_pWMPPlayer->put_URL( wxBasicString(location) );
|
||||
}
|
||||
|
||||
if(FAILED(hr))
|
||||
@@ -1061,12 +1061,12 @@ bool wxWMP10MediaBackend::ShowPlayerControls(wxMediaCtrlPlayerControls flags)
|
||||
if(!flags)
|
||||
{
|
||||
m_pWMPPlayer->put_enabled(VARIANT_FALSE);
|
||||
m_pWMPPlayer->put_uiMode(wxBasicString(wxT("none")).Detach());
|
||||
m_pWMPPlayer->put_uiMode(wxBasicString(wxT("none")));
|
||||
}
|
||||
else
|
||||
{
|
||||
// TODO: use "custom"? (note that CE only supports none/full)
|
||||
m_pWMPPlayer->put_uiMode(wxBasicString(wxT("full")).Detach());
|
||||
m_pWMPPlayer->put_uiMode(wxBasicString(wxT("full")));
|
||||
m_pWMPPlayer->put_enabled(VARIANT_TRUE);
|
||||
}
|
||||
|
||||
@@ -1358,7 +1358,7 @@ wxLongLong wxWMP10MediaBackend::GetDownloadTotal()
|
||||
if(m_pWMPPlayer->get_currentMedia(&pWMPMedia) == 0)
|
||||
{
|
||||
BSTR bsOut;
|
||||
pWMPMedia->getItemInfo(wxBasicString(wxT("FileSize")).Detach(),
|
||||
pWMPMedia->getItemInfo(wxBasicString(wxT("FileSize")),
|
||||
&bsOut);
|
||||
|
||||
wxString sFileSize = wxConvertStringFromOle(bsOut);
|
||||
|
Reference in New Issue
Block a user