summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mir_core/src/mstring.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/mir_core/src/mstring.cpp b/src/mir_core/src/mstring.cpp
index 1ce935a2e3..b3c6e99094 100644
--- a/src/mir_core/src/mstring.cpp
+++ b/src/mir_core/src/mstring.cpp
@@ -45,7 +45,7 @@ CNilMStringData::CNilMStringData()
achNil[1] = 0;
}
-static CNilMStringData m_nil;
+static CNilMStringData *m_nil = NULL;
/////////////////////////////////////////////////////////////////////////////////////////
// CMBaseString
@@ -68,8 +68,7 @@ MIR_CORE_DLL(CMStringData*) mirstr_allocate(int nChars, int nCharSize)
MIR_CORE_DLL(void) mirstr_free(CMStringData *pData)
{
- if (pData != &m_nil)
- free(pData);
+ free(pData);
}
MIR_CORE_DLL(CMStringData*) mirstr_realloc(CMStringData* pData, int nChars, int nCharSize)
@@ -88,8 +87,10 @@ MIR_CORE_DLL(CMStringData*) mirstr_realloc(CMStringData* pData, int nChars, int
MIR_CORE_DLL(CMStringData*) mirstr_getNil()
{
- m_nil.AddRef();
- return &m_nil;
+ if (m_nil == NULL)
+ m_nil = new CNilMStringData();
+ m_nil->AddRef();
+ return m_nil;
}
/////////////////////////////////////////////////////////////////////////////////////////