From ca5e07c7683a6b4c63dc6d4d05c75ba46d0b0de8 Mon Sep 17 00:00:00 2001 From: Gilles Depeyrot Date: Wed, 28 May 2003 21:11:17 +0000 Subject: [PATCH] VC++ free must take place in same DLL as allocation when using non dll run-time library (e.g. Multithreaded instead of Multithreaded DLL) we must not inline wxStringData deallocation since allocation is not inlined git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@20755 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/string.h | 7 ++++++- src/common/string.cpp | 9 +++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/include/wx/string.h b/include/wx/string.h index b4a6fa1..852f671 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -195,7 +195,12 @@ struct WXDLLEXPORT wxStringData #if defined(__VISUALC__) && (__VISUALC__ >= 1200) __forceinline #endif - void Unlock() { if ( !IsEmpty() && --nRefs == 0) free(this); } + void Unlock() { if ( !IsEmpty() && --nRefs == 0) Free(); } + + // VC++ free must take place in same DLL as allocation when using non dll + // run-time library (e.g. Multithreaded instead of Multithreaded DLL) + // we must not inline deallocation since allocation is not inlined + void Free(); // if we had taken control over string memory (GetWriteBuf), it's // intentionally put in invalid state diff --git a/src/common/string.cpp b/src/common/string.cpp index 791c5ce..d0b3fac 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -161,6 +161,15 @@ wxSTD ostream& operator<<(wxSTD ostream& os, const wxString& str) #endif // WXSTRING_STATISTICS // =========================================================================== +// wxStringData class deallocation +// =========================================================================== + +void wxStringData::Free() +{ + free(this); +} + +// =========================================================================== // wxString class core // =========================================================================== -- 2.7.4