]> git.saurik.com Git - wxWidgets.git/commitdiff
VC++ free must take place in same DLL as allocation when using non dll
authorGilles Depeyrot <gilles_depeyrot@mac.com>
Wed, 28 May 2003 21:11:17 +0000 (21:11 +0000)
committerGilles Depeyrot <gilles_depeyrot@mac.com>
Wed, 28 May 2003 21:11:17 +0000 (21:11 +0000)
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
src/common/string.cpp

index b4a6fa1df7f5c156cf7cbe28788341e24d7a7c20..852f67115b56b15c22c0ed502e9f05e042c4d145 100644 (file)
@@ -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
index 791c5ce049d2f4836b45afc46b3e628eb810b2fc..d0b3facc6b40bd21f8c5974004592df0cef3350b 100644 (file)
@@ -160,6 +160,15 @@ wxSTD ostream& operator<<(wxSTD ostream& os, const wxString& str)
   #define STATISTICS_ADD(av, val)
 #endif // WXSTRING_STATISTICS
 
+// ===========================================================================
+// wxStringData class deallocation
+// ===========================================================================
+
+void wxStringData::Free()
+{
+    free(this);
+}
+
 // ===========================================================================
 // wxString class core
 // ===========================================================================