fixed compilation with CW8 (SF patch 567845) and also added alignment fillers for wxCriticalSection::m_buffer
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@15898 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -241,11 +241,23 @@ private:
|
|||||||
#elif defined(__WXMSW__)
|
#elif defined(__WXMSW__)
|
||||||
// we can't allocate any memory in the ctor, so use placement new -
|
// we can't allocate any memory in the ctor, so use placement new -
|
||||||
// unfortunately, we have to hardcode the sizeof() here because we can't
|
// unfortunately, we have to hardcode the sizeof() here because we can't
|
||||||
// include windows.h from this public header
|
// include windows.h from this public header and we also have to use the
|
||||||
|
// union to force the correct (i.e. maximal) alignment
|
||||||
//
|
//
|
||||||
// if CRITICAL_SECTION size changes in Windows, you'll get an assert from
|
// if CRITICAL_SECTION size changes in Windows, you'll get an assert from
|
||||||
// thread.cpp and will need to increase the buffer size
|
// thread.cpp and will need to increase the buffer size
|
||||||
char m_buffer[24];
|
//
|
||||||
|
// finally, we need this typedef instead of declaring m_buffer directly
|
||||||
|
// because otherwise the assert mentioned above wouldn't compile with some
|
||||||
|
// compilers (notably CodeWarrior 8)
|
||||||
|
typedef char wxCritSectBuffer[24];
|
||||||
|
union
|
||||||
|
{
|
||||||
|
unsigned long m_dummy1;
|
||||||
|
void *m_dummy2;
|
||||||
|
|
||||||
|
wxCritSectBuffer m_buffer;
|
||||||
|
};
|
||||||
#else
|
#else
|
||||||
// nothing for OS/2
|
// nothing for OS/2
|
||||||
#endif // Unix/Win32/OS2
|
#endif // Unix/Win32/OS2
|
||||||
|
@@ -132,7 +132,7 @@ static bool gs_waitingForThread = FALSE;
|
|||||||
|
|
||||||
wxCriticalSection::wxCriticalSection()
|
wxCriticalSection::wxCriticalSection()
|
||||||
{
|
{
|
||||||
wxCOMPILE_TIME_ASSERT( sizeof(CRITICAL_SECTION) <= sizeof(m_buffer),
|
wxCOMPILE_TIME_ASSERT( sizeof(CRITICAL_SECTION) <= sizeof(wxCritSectBuffer),
|
||||||
wxCriticalSectionBufferTooSmall );
|
wxCriticalSectionBufferTooSmall );
|
||||||
|
|
||||||
::InitializeCriticalSection((CRITICAL_SECTION *)m_buffer);
|
::InitializeCriticalSection((CRITICAL_SECTION *)m_buffer);
|
||||||
|
Reference in New Issue
Block a user