fix premature object deletion reported by Paul in tcl3d

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8836 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2006-02-18 01:19:50 +00:00
commit f641130612
3 changed files with 95 additions and 6 deletions

View file

@ -64,14 +64,26 @@
* Tcl extra typemaps
* ------------------------------------------------------------ */
#if 1
// Old 1.3.25 typemaps needed to avoid premature object deletion
%typemap(out,noblock=1) SWIGTYPE *INSTANCE, SWIGTYPE &INSTANCE, SWIGTYPE INSTANCE[] {
Tcl_SetObjResult(interp, SWIG_NewInstanceObj( %as_voidptr($1), $1_descriptor,0));
}
%typemap(out) SWIGTYPE *DYNAMIC, SWIGTYPE &DYNAMIC {
swig_type_info *ty = SWIG_TypeDynamicCast($1_descriptor,%as_voidptrptr(&$1));
Tcl_SetObjResult(interp,SWIG_NewInstanceObj(%as_voidptr($1), ty,0));
}
#endif
%typemap(throws,noblock=1) SWIGTYPE CLASS {
SWIG_set_result(SWIG_NewInstanceObj(%as_voidptr(SWIG_new_copy($1, $1_ltype)), $&1_descriptor, 1));
SWIG_fail;
}
%typemap(out) SWIGTYPE = SWIGTYPE INSTANCE;
%typemap(out) SWIGTYPE * = SWIGTYPE *INSTANCE;
%typemap(out) SWIGTYPE & = SWIGTYPE &INSTANCE;
%typemap(out) SWIGTYPE [] = SWIGTYPE INSTANCE[];
%typemap(varout) SWIGTYPE = SWIGTYPE INSTANCE;
%typemap(throws,noblock=1) SWIGTYPE CLASS {
SWIG_set_result(SWIG_NewInstanceObj(SWIG_as_voidptr(SWIG_new_copy($1, $1_ltype)), $&1_descriptor, 1));
SWIG_fail;
}