Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/LAVFilters.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2013-10-27 13:51:11 +0400
committerHendrik Leppkes <h.leppkes@gmail.com>2013-10-27 13:51:11 +0400
commitbc765d0de64cbc82bb8eb616747fe1b8072461a6 (patch)
tree40cbf090323032a00272c20b0ae6679b6a011d33 /demuxer
parent602b085c95f5edb58bee16b3dd1f686eac8d4125 (diff)
Re-design the cleanup functionality of the tray icon
Instead of the tray icon thread trying to clean itself up, call the destructor externally and wait until it closed itself. This ensures all resources are free'ed and no race conditions can cause invalid access later on. Suggested by Lord.
Diffstat (limited to 'demuxer')
-rw-r--r--demuxer/LAVSplitter/LAVSplitter.cpp18
1 files changed, 4 insertions, 14 deletions
diff --git a/demuxer/LAVSplitter/LAVSplitter.cpp b/demuxer/LAVSplitter/LAVSplitter.cpp
index f55587f0..a595a239 100644
--- a/demuxer/LAVSplitter/LAVSplitter.cpp
+++ b/demuxer/LAVSplitter/LAVSplitter.cpp
@@ -89,10 +89,7 @@ CLAVSplitter::CLAVSplitter(LPUNKNOWN pUnk, HRESULT* phr)
CLAVSplitter::~CLAVSplitter()
{
SAFE_DELETE(m_pInput);
- if (m_pTrayIcon) {
- m_pTrayIcon->Destroy();
- m_pTrayIcon = NULL;
- }
+ SAFE_DELETE(m_pTrayIcon);
Close();
// delete old pins
@@ -140,8 +137,7 @@ STDMETHODIMP CLAVSplitter::JoinFilterGraph(IFilterGraph * pGraph, LPCWSTR pName)
if (pGraph && !m_pTrayIcon && m_settings.TrayIcon) {
CreateTrayIcon();
} else if (!pGraph && m_pTrayIcon) {
- m_pTrayIcon->Destroy();
- m_pTrayIcon = NULL;
+ SAFE_DELETE(m_pTrayIcon);
}
return hr;
}
@@ -1522,10 +1518,7 @@ HRESULT CLAVSplitter::SetRuntimeConfig(BOOL bRuntimeConfig)
LoadSettings();
// Tray Icon is disabled by default
- if (m_pTrayIcon) {
- m_pTrayIcon->Destroy();
- m_pTrayIcon = NULL;
- }
+ SAFE_DELETE(m_pTrayIcon);
return S_OK;
}
@@ -1746,10 +1739,7 @@ STDMETHODIMP CLAVSplitter::SetTrayIcon(BOOL bEnabled)
{
m_settings.TrayIcon = bEnabled;
if (!bEnabled && m_pTrayIcon) {
- if (m_pTrayIcon) {
- m_pTrayIcon->Destroy();
- m_pTrayIcon = NULL;
- }
+ SAFE_DELETE(m_pTrayIcon);
} else if (bEnabled && m_pGraph && !m_pTrayIcon) {
CreateTrayIcon();
}