Browse files

Just override the destructor calling convention

  • Loading branch information...
mniip committed May 12, 2018
1 parent 11d7735 commit 139e6c4ce54e608042b5fedd47f0982cdda41365
Showing with 11 additions and 18 deletions.
  1. +11 −18 src/common/String.cpp
@@ -294,22 +294,25 @@ char const numberChars[] = "-.+0123456789ABCDEFXabcdefx";
ByteString numberByteString(numberChars);
String numberString(numberChars);
static thread_local std::basic_stringstream<char> *LocaleImplStream;
static thread_local std::basic_stringstream<wchar_t> *LocaleImplWStream;
static thread_local struct LocaleImpl
std::basic_stringstream<char> &stream;
std::basic_stringstream<wchar_t> &wstream;
std::basic_stringstream<char> stream;
std::basic_stringstream<wchar_t> wstream;
stream(*(LocaleImplStream = new std::basic_stringstream<char>())),
wstream(*(LocaleImplWStream = new std::basic_stringstream<wchar_t>()))
#if defined(WIN) && defined(__GNUC__) && !defined(_64BIT)
// The MinGW WIN32 threading model is currently broken in that the
// runtime invokes the destructors via cdecl, while the compiled code
// expects thiscall.
__cdecl ~LocaleImpl()
inline void PrepareStream(ByteStringBuilder &b)
@@ -379,16 +382,6 @@ static thread_local struct LocaleImpl
// This specific implementation of destruction seems to help against the
// currently broken WIN32 threading model on MinGW. The real destructor is
// called by the runtime as cdecl but the compiled code expects thiscall.
delete LocaleImplStream;
delete LocaleImplWStream;
ByteString ByteStringBuilder::Build() const
return ByteString(buffer.begin(), buffer.end());

0 comments on commit 139e6c4

Please sign in to comment.