From d07b88876d58517b79fe6115261b2c87052feaae Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 17 Jun 2015 08:11:13 +0000 Subject: fix for a crash with german langpack git-svn-id: http://svn.miranda-ng.org/main/trunk@14229 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/mir_core/src/mstring.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'src') 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; } ///////////////////////////////////////////////////////////////////////////////////////// -- cgit v1.2.3