diff --git a/CHANGES.current b/CHANGES.current index 9cb296a82..aed2305c1 100644 --- a/CHANGES.current +++ b/CHANGES.current @@ -1,9 +1,13 @@ Version 1.3.32 (in progress) ============================ +08/01/2007: wsfulton + Fix smart pointer handling for classes that have templated methods within the smart + pointer type. Problem reported by craigdo at ee.washington.edu. + 07/31/2007: efuzzyone - [cffi] fixed memory access after being freed bug. thanks to Martin Percossi. - package name clos changed to cl. thanks to Ralf Mattes + [cffi] fixed memory access after being freed bug. thanks to Martin Percossi. + package name clos changed to cl. thanks to Ralf Mattes 07/24/2007: wsfulton Parallel make support added for the examples and test-suite for developers who have diff --git a/Examples/test-suite/common.mk b/Examples/test-suite/common.mk index 6a45aa476..4fd475ca1 100644 --- a/Examples/test-suite/common.mk +++ b/Examples/test-suite/common.mk @@ -242,6 +242,7 @@ CPP_TEST_CASES += \ smart_pointer_overload \ smart_pointer_protected \ smart_pointer_rename \ + smart_pointer_templatemethods \ smart_pointer_simple \ smart_pointer_static \ smart_pointer_typedef \ diff --git a/Examples/test-suite/smart_pointer_templatemethods.i b/Examples/test-suite/smart_pointer_templatemethods.i new file mode 100644 index 000000000..7baa6386a --- /dev/null +++ b/Examples/test-suite/smart_pointer_templatemethods.i @@ -0,0 +1,52 @@ + +%module smart_pointer_templatemethods + +%inline %{ +namespace ns { + +template +class Ptr +{ +public: + Ptr () {} + T *operator -> () { return 0; } +}; + +typedef unsigned short uint16_t; +class InterfaceId +{ +public: + InterfaceId (uint16_t iid) {} + InterfaceId() {} +}; + +template class Objekt +{ +public: + Objekt () {} + virtual ~Objekt () {} + Ptr QueryInterface (InterfaceId iid) const { return Ptr(); } + void DisposeObjekt (void) {} +}; + +class Object +{ +public: + Object () {} + virtual ~Object () {} + template Ptr QueryInterface (InterfaceId iid) const { return Ptr(); } + void DisposeObject (void) {} +}; + +#ifdef SWIG +%template(PtrObject) Ptr; +%template(PtrInt) Ptr; +%template(ObjektInt) Objekt; +%template(PtrObjektInt) Ptr >; +%template(QueryInterfaceObject) Object::QueryInterface; +#endif + +}; // namespace + +%} + diff --git a/Source/Modules/lang.cxx b/Source/Modules/lang.cxx index fefe7becb..f39ea7319 100644 --- a/Source/Modules/lang.cxx +++ b/Source/Modules/lang.cxx @@ -1224,7 +1224,7 @@ int Language::memberfunctionHandler(Node *n) { if (GetFlag(n, "explicitcall")) DirectorExtraCall = CWRAP_DIRECTOR_ONE_CALL; - Swig_MethodToFunction(n, ClassType, Getattr(n, "template") ? 0 : Extend | SmartPointer | DirectorExtraCall, director_type, + Swig_MethodToFunction(n, ClassType, Getattr(n, "template") ? SmartPointer : Extend | SmartPointer | DirectorExtraCall, director_type, is_member_director(CurrentClass, n)); Setattr(n, "sym:name", fname); functionWrapper(n);