Use Interlocked* functions in AddRef and Release.
diff --git a/dlls/mlang/mlang.c b/dlls/mlang/mlang.c
index a91b021..10ed940 100644
--- a/dlls/mlang/mlang.c
+++ b/dlls/mlang/mlang.c
@@ -624,13 +624,13 @@
static ULONG WINAPI MLANGCF_AddRef(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
- return ++(This->ref);
+ return InterlockedIncrement(&This->ref);
}
static ULONG WINAPI MLANGCF_Release(LPCLASSFACTORY iface) {
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
- ULONG ref = --This->ref;
+ ULONG ref = InterlockedDecrement(&This->ref);
if (ref == 0)
{
@@ -733,12 +733,12 @@
static ULONG WINAPI MLang_AddRef( MLang_impl* This)
{
- return ++(This->ref);
+ return InterlockedIncrement(&This->ref);
}
static ULONG WINAPI MLang_Release( MLang_impl* This )
{
- ULONG ref = --This->ref;
+ ULONG ref = InterlockedDecrement(&This->ref);
TRACE("%p ref = %ld\n", This, ref);
if (ref == 0)
@@ -823,14 +823,14 @@
IEnumCodePage* iface)
{
ICOM_THIS_MULTI(EnumCodePage_impl, vtbl_IEnumCodePage, iface);
- return ++(This->ref);
+ return InterlockedIncrement(&This->ref);
}
static ULONG WINAPI fnIEnumCodePage_Release(
IEnumCodePage* iface)
{
ICOM_THIS_MULTI(EnumCodePage_impl, vtbl_IEnumCodePage, iface);
- ULONG ref = --This->ref;
+ ULONG ref = InterlockedDecrement(&This->ref);
TRACE("%p ref = %ld\n", This, ref);
if (ref == 0)
@@ -1009,14 +1009,14 @@
IEnumScript* iface)
{
ICOM_THIS_MULTI(EnumScript_impl, vtbl_IEnumScript, iface);
- return ++(This->ref);
+ return InterlockedIncrement(&This->ref);
}
static ULONG WINAPI fnIEnumScript_Release(
IEnumScript* iface)
{
ICOM_THIS_MULTI(EnumScript_impl, vtbl_IEnumScript, iface);
- ULONG ref = --This->ref;
+ ULONG ref = InterlockedDecrement(&This->ref);
TRACE("%p ref = %ld\n", This, ref);
if (ref == 0)