add owndata field to swig_type_info, so clientdata can be properly delete if needed

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7822 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2005-11-08 15:53:30 +00:00
commit f2d1e94900
2 changed files with 9 additions and 3 deletions

View file

@ -67,6 +67,7 @@ typedef struct swig_type_info {
swig_dycast_func dcast; /* dynamic cast function down a hierarchy */
struct swig_cast_info *cast; /* linked list of types that can cast into this type */
void *clientdata; /* language specific type data */
int owndata; /* flag if the structure owns the clientdata */
} swig_type_info;
/* Structure to store a type and conversion function used for casting */
@ -253,7 +254,12 @@ SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
cast = cast->next;
}
}
SWIGRUNTIME void
SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
SWIG_TypeClientData(ti, clientdata);
ti->owndata = 1;
}
/*
Search for a swig_type_info structure only by mangled name
Search is a O(log #types)

View file

@ -1875,7 +1875,7 @@ SwigType_emit_type_table(File *f_forward, File *f_table) {
} else {
nt = NewStringf("%s|%s", rn, ln);
}
Printf(types, "\"%s\", \"%s\", 0, 0, %s};\n", ki.item, nt, cd);
Printf(types, "\"%s\", \"%s\", 0, 0, %s, 0};\n", ki.item, nt, cd);
el = SwigType_equivalent_mangle(ki.item,0,0);
for (ei = First(el); ei.item; ei = Next(ei)) {
@ -1891,7 +1891,7 @@ SwigType_emit_type_table(File *f_forward, File *f_table) {
Delete(ckey);
if (!Getattr(r_mangled, ei.item) && !Getattr(imported_types, ei.item)) {
Printf(types, "static swig_type_info _swigt_%s = {\"%s\", 0, 0, 0, 0};\n", ei.item, ei.item);
Printf(types, "static swig_type_info _swigt_%s = {\"%s\", 0, 0, 0, 0, 0};\n", ei.item, ei.item);
Append(table_list, ei.item);
Printf(cast, "static swig_cast_info _swigc_%s[] = {{&_swigt_%s, 0, 0, 0},{0, 0, 0, 0}};\n",