summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'plugins')
-rw-r--r--plugins/HistoryStats/src/utils.cpp8
-rw-r--r--plugins/HistoryStats/src/utils.h2
2 files changed, 2 insertions, 8 deletions
diff --git a/plugins/HistoryStats/src/utils.cpp b/plugins/HistoryStats/src/utils.cpp
index 5b6a781784..c00fb7a43c 100644
--- a/plugins/HistoryStats/src/utils.cpp
+++ b/plugins/HistoryStats/src/utils.cpp
@@ -1001,13 +1001,11 @@ void RTFFilter::init()
m_Data.m_hRTFConv = NULL;
}
- InitializeCriticalSection(&m_Data.m_RTFConvCS);
}
void RTFFilter::uninit()
{
if (m_Data.m_hRTFConv) {
- DeleteCriticalSection(&m_Data.m_RTFConvCS);
FreeLibrary(m_Data.m_hRTFConv);
m_Data.m_hRTFConv = NULL;
@@ -1018,7 +1016,7 @@ void RTFFilter::uninit()
ext::t::string RTFFilter::filter(const ext::t::string& str)
{
// protect, because library is not thread-safe
- EnterCriticalSection(&m_Data.m_RTFConvCS);
+ mir_cslock lck(m_Data.m_RTFConvCS);
#if defined(_UNICODE)
const ext::a::string strA = utils::toA(str);
@@ -1036,7 +1034,6 @@ ext::t::string RTFFilter::filter(const ext::t::string& str)
if (len == -1) {
// someting went wrong, maybe it's not a real RTF string
- LeaveCriticalSection(&m_Data.m_RTFConvCS);
return str;
}
@@ -1054,15 +1051,12 @@ ext::t::string RTFFilter::filter(const ext::t::string& str)
// someting went wrong, maybe it's not a real RTF string
delete[] out_buf;
- LeaveCriticalSection(&m_Data.m_RTFConvCS);
return str;
}
ext::t::string out_str(out_buf, res / sizeof(TCHAR)-1);
delete[] out_buf;
- LeaveCriticalSection(&m_Data.m_RTFConvCS);
-
return out_str;
}
diff --git a/plugins/HistoryStats/src/utils.h b/plugins/HistoryStats/src/utils.h
index 7112389d37..8c2160dee6 100644
--- a/plugins/HistoryStats/src/utils.h
+++ b/plugins/HistoryStats/src/utils.h
@@ -161,7 +161,7 @@ private:
private:
HMODULE m_hRTFConv;
RTFCONVSTRING m_RTFConvString;
- CRITICAL_SECTION m_RTFConvCS;
+ mir_cs m_RTFConvCS;
private:
explicit RTFFilter();