Index: src/plugin/PluginClass.cpp |
=================================================================== |
--- a/src/plugin/PluginClass.cpp |
+++ b/src/plugin/PluginClass.cpp |
@@ -36,7 +36,7 @@ |
ATOM CPluginClass::s_atomPaneClass = NULL; |
HINSTANCE CPluginClass::s_hUxtheme = NULL; |
-CSimpleArray<CPluginClass*> CPluginClass::s_instances; |
+std::set<CPluginClass*> CPluginClass::s_instances; |
std::map<DWORD, CPluginClass*> CPluginClass::s_threadInstances; |
CComAutoCriticalSection CPluginClass::s_criticalSectionLocal; |
@@ -261,7 +261,7 @@ |
// Always register on startup, then check if we need to unregister in a separate thread |
s_mimeFilter = CPluginClientFactory::GetMimeFilterClientInstance(); |
s_asyncWebBrowser2 = unknownSite; |
- s_instances.Add(this); |
+ s_instances.insert(this); |
} |
s_criticalSectionLocal.Unlock(); |
@@ -365,14 +365,14 @@ |
s_criticalSectionLocal.Lock(); |
{ |
- s_instances.Remove(this); |
+ s_instances.erase(this); |
std::map<DWORD,CPluginClass*>::iterator it = s_threadInstances.find(::GetCurrentThreadId()); |
if (it != s_threadInstances.end()) |
{ |
s_threadInstances.erase(it); |
} |
- if (s_instances.GetSize() == 0) |
+ if (s_instances.empty()) |
{ |
CPluginClientFactory::ReleaseMimeFilterClientInstance(); |
} |
@@ -893,11 +893,10 @@ |
s_criticalSectionLocal.Lock(); |
{ |
- for (int i = 0; i < s_instances.GetSize(); i++) |
+ for (auto instance : s_instances) |
{ |
- if (s_instances[i]->m_hTabWnd == hTabWnd2) |
+ if (instance->m_hTabWnd == hTabWnd2) |
{ |
- |
bExistingTab = true; |
break; |
} |
@@ -1062,22 +1061,22 @@ |
CPluginClass* CPluginClass::FindInstance(HWND hStatusBarWnd) |
{ |
- CPluginClass* instance = NULL; |
+ CPluginClass* return_instance = nullptr; |
Wladimir Palant
2014/07/24 06:41:53
Nit: this variable should simply be called "result
Eric
2014/07/24 12:33:48
Done.
|
s_criticalSectionLocal.Lock(); |
{ |
- for (int i = 0; i < s_instances.GetSize(); i++) |
+ for (auto instance : s_instances) |
{ |
- if (s_instances[i]->m_hStatusBarWnd == hStatusBarWnd) |
+ if (instance->m_hStatusBarWnd == hStatusBarWnd) |
{ |
- instance = s_instances[i]; |
+ return_instance = instance; |
break; |
} |
} |
} |
s_criticalSectionLocal.Unlock(); |
- return instance; |
+ return return_instance; |
} |
CPluginTab* CPluginClass::GetTab() |
@@ -1949,9 +1948,9 @@ |
s_criticalSectionLocal.Lock(); |
{ |
- for (int i = 0; i < s_instances.GetSize(); i++) |
+ for (auto instance : s_instances) |
{ |
- if (s_instances[i]->m_hTabWnd == hTabWnd2) |
+ if (instance->m_hTabWnd == hTabWnd2) |
{ |
bExistingTab = true; |
break; |