workaround for mingw 3.2.3 DLL build with wxUSE_STL=1
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@38292 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
d294c9db88
commit
30a29593e8
@ -135,15 +135,42 @@ private:
|
||||
|
||||
#endif // defined( __VISUALC__ )
|
||||
|
||||
/*
|
||||
Note: the outer helper class _WX_LIST_HELPER_##liT below is a workaround
|
||||
for mingw 3.2.3 compiler bug that prevents a static function of liT class
|
||||
from being exported into dll. A minimal code snippet reproducing the bug:
|
||||
|
||||
struct WXDLLEXPORT Foo
|
||||
{
|
||||
static void Bar();
|
||||
struct SomeInnerClass
|
||||
{
|
||||
friend class Foo; // comment this out to make it link
|
||||
};
|
||||
~Foo()
|
||||
{
|
||||
Bar();
|
||||
}
|
||||
};
|
||||
|
||||
The program does not link under mingw_gcc 3.2.3 producing undefined
|
||||
reference to Foo::Bar() function
|
||||
*/
|
||||
|
||||
// the real wxList-class declaration
|
||||
#define WX_DECLARE_LIST_XO(elT, liT, decl) \
|
||||
class WXDLLEXPORT _WX_LIST_HELPER_##liT \
|
||||
{ \
|
||||
typedef elT _WX_LIST_ITEM_TYPE_##liT; \
|
||||
public: \
|
||||
static void DeleteFunction( _WX_LIST_ITEM_TYPE_##liT X ); \
|
||||
}; \
|
||||
\
|
||||
VC6_WORKAROUND(elT, liT, decl) \
|
||||
decl liT : public std::list<elT> \
|
||||
{ \
|
||||
private: \
|
||||
bool m_destroy; \
|
||||
private: \
|
||||
typedef elT _WX_LIST_ITEM_TYPE_##liT; \
|
||||
static void DeleteFunction( _WX_LIST_ITEM_TYPE_##liT X ); \
|
||||
public: \
|
||||
decl compatibility_iterator \
|
||||
{ \
|
||||
@ -269,7 +296,7 @@ private:
|
||||
void Erase( const compatibility_iterator& i ) \
|
||||
{ \
|
||||
if ( m_destroy ) \
|
||||
DeleteFunction( i->GetData() ); \
|
||||
_WX_LIST_HELPER_##liT::DeleteFunction( i->GetData() ); \
|
||||
erase( i.m_iter ); \
|
||||
} \
|
||||
bool DeleteNode( const compatibility_iterator& i ) \
|
||||
@ -288,7 +315,8 @@ private:
|
||||
void Clear() \
|
||||
{ \
|
||||
if ( m_destroy ) \
|
||||
std::for_each( begin(), end(), DeleteFunction ); \
|
||||
std::for_each( begin(), end(), \
|
||||
_WX_LIST_HELPER_##liT::DeleteFunction ); \
|
||||
clear(); \
|
||||
} \
|
||||
/* Workaround for broken VC6 std::list::sort() see above */ \
|
||||
|
@ -12,10 +12,10 @@
|
||||
#if wxUSE_STL
|
||||
|
||||
#undef WX_DEFINE_LIST
|
||||
#define WX_DEFINE_LIST(name) \
|
||||
void name::DeleteFunction( _WX_LIST_ITEM_TYPE_##name X ) \
|
||||
{ \
|
||||
delete X; \
|
||||
#define WX_DEFINE_LIST(name) \
|
||||
void _WX_LIST_HELPER_##name::DeleteFunction( _WX_LIST_ITEM_TYPE_##name X ) \
|
||||
{ \
|
||||
delete X; \
|
||||
}
|
||||
|
||||
#else // if !wxUSE_STL
|
||||
|
@ -760,7 +760,7 @@ wxNode *wxStringList::Prepend(const wxChar *s)
|
||||
WX_DEFINE_LIST(wxObjectList)
|
||||
|
||||
// with wxUSE_STL wxStringList contains wxString objects, not pointers
|
||||
void wxStringListBase::DeleteFunction( wxString WXUNUSED(X) )
|
||||
void _WX_LIST_HELPER_wxStringListBase::DeleteFunction( wxString WXUNUSED(X) )
|
||||
{
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user