Code: Select all
//
// sp##v could get invalid by property object unloading, while dll is never released,
// so the static sp##v can become a dangling pointer.
//
// So for now, try to save RepIndex directly. which should be constant.
//
// Also note, that the initialization time for the static variables are compiler
// dependend, so other compiles unlike MSVC6 may initialize them at dll load time
// before the property may be correctly loaded.
//
//#define DOREP(c,v) \
// if( NEQ(v,((A##c*)Recent)->v,Map) ) \
// { \
// static UProperty* sp##v = FindObjectChecked<UProperty>(A##c::StaticClass(),TEXT(#v)); \
// *Ptr++ = sp##v->RepIndex; \
// }
//
//#define DOREPARRAY(c,v) \
// {static UProperty* sp##v = FindObjectChecked<UProperty>(A##c::StaticClass(),TEXT(#v)); \
// for( INT i=0; i<ARRAY_COUNT(v); i++ ) \
// if( NEQ(v[i],((A##c*)Recent)->v[i],Map) ) \
// *Ptr++ = sp##v->RepIndex+i;}
//
//#define DOREPARRAYINDEX(c,v,i) \
// {static UProperty* sp##v = FindObjectChecked<UProperty>(A##c::StaticClass(),TEXT(#v)); \
// if( NEQ(v[i],((A##c*)Recent)->v[i],Map) ) \
// *Ptr++ = sp##v->RepIndex+i;}
//
#define DOREP(c,v) \
static INT s##c##v##RepIndex = FindObjectChecked<UProperty>(A##c::StaticClass(),TEXT(#v))->RepIndex; \
if( NEQ(v,((A##c*)Recent)->v,Map) ) \
*Ptr++ = s##c##v##RepIndex;
#define DOREPARRAY(c,v) \
static INT s##c##v##RepIndex = FindObjectChecked<UProperty>(A##c::StaticClass(),TEXT(#v))->RepIndex; \
for( INT i=0; i<ARRAY_COUNT(v); i++ ) \
if( NEQ(v[i],((A##c*)Recent)->v[i],Map) ) \
*Ptr++ = s##c##v##RepIndex+i;
#define DOREPARRAYINDEX(c,v,i) \
static INT s##c##v##i##RepIndex = FindObjectChecked<UProperty>(A##c::StaticClass(),TEXT(#v))->RepIndex+i; \
if( NEQ(v[i],((A##c*)Recent)->v[i],Map) ) \
*Ptr++ = s##c##v##i##RepIndex;
Found a potential use after free hazard for the nativereplication stuff. So you should at lesat use the above updated macros.