Put the code implementing object arrays, i.e. arrays owning pointers to the objects, into wxBaseObjectArray<> instead of _WX_DECLARE_OBJARRAY macro. Also simplify WX_DEFINE_OBJARRAY() by leaving only the definitions of functions creating and destroying the objects in it (they have to be there and not in the template itself to allow using template with incomplete classes).