Fix seg fault in SWIG using directors when class and virtual method names are the same except being in different namespaces when the %nspace feature is not being used.

This commit is contained in:
William S Fulton 2013-03-19 18:34:06 +00:00
commit e182b4844c
4 changed files with 11 additions and 35 deletions

View file

@ -5,6 +5,10 @@ See the RELEASENOTES file for a summary of changes in each release.
Version 2.0.10 (in progress) Version 2.0.10 (in progress)
============================ ============================
2013-03-19: wsfulton
[C#, Java, D] Fix seg fault in SWIG using directors when class and virtual method names are
the same except being in different namespaces when the %nspace feature is not being used.
2013-02-19: kwwette 2013-02-19: kwwette
Fix bug in SWIG's handling of qualified (e.g. const) variables of array type. Given the typedef Fix bug in SWIG's handling of qualified (e.g. const) variables of array type. Given the typedef
a(7).q(volatile).double myarray // typedef volatile double[7] myarray; a(7).q(volatile).double myarray // typedef volatile double[7] myarray;

View file

@ -630,23 +630,14 @@ public:
*----------------------------------------------------------------------*/ *----------------------------------------------------------------------*/
UpcallData *addUpcallMethod(String *imclass_method, String *class_method, String *decl, String *overloaded_name) { UpcallData *addUpcallMethod(String *imclass_method, String *class_method, String *decl, String *overloaded_name) {
UpcallData *udata;
String *class_methodidx;
Hash *new_udata;
String *key = NewStringf("%s|%s", imclass_method, decl); String *key = NewStringf("%s|%s", imclass_method, decl);
++curr_class_dmethod; ++curr_class_dmethod;
/* Do we know about this director class already? */ String *class_methodidx = NewStringf("%d", n_dmethods - first_class_dmethod);
if ((udata = Getattr(dmethods_table, key))) {
Delete(key);
return Getattr(udata, "methodoff");
}
class_methodidx = NewStringf("%d", n_dmethods - first_class_dmethod);
n_dmethods++; n_dmethods++;
new_udata = NewHash(); Hash *new_udata = NewHash();
Append(dmethods_seq, new_udata); Append(dmethods_seq, new_udata);
Setattr(dmethods_table, key, new_udata); Setattr(dmethods_table, key, new_udata);

View file

@ -3704,23 +3704,14 @@ private:
UpcallData *addUpcallMethod(String *imclass_method, String *class_method, UpcallData *addUpcallMethod(String *imclass_method, String *class_method,
String *decl, String *overloaded_name, String *return_type, String *param_list) { String *decl, String *overloaded_name, String *return_type, String *param_list) {
UpcallData *udata;
String *class_methodidx;
Hash *new_udata;
String *key = NewStringf("%s|%s", imclass_method, decl); String *key = NewStringf("%s|%s", imclass_method, decl);
++curr_class_dmethod; ++curr_class_dmethod;
/* Do we know about this director class already? */ String *class_methodidx = NewStringf("%d", n_dmethods - first_class_dmethod);
if ((udata = Getattr(dmethods_table, key))) {
Delete(key);
return Getattr(udata, "methodoff");
}
class_methodidx = NewStringf("%d", n_dmethods - first_class_dmethod);
n_dmethods++; n_dmethods++;
new_udata = NewHash(); Hash *new_udata = NewHash();
Append(dmethods_seq, new_udata); Append(dmethods_seq, new_udata);
Setattr(dmethods_table, key, new_udata); Setattr(dmethods_table, key, new_udata);

View file

@ -741,25 +741,15 @@ public:
*----------------------------------------------------------------------*/ *----------------------------------------------------------------------*/
UpcallData *addUpcallMethod(String *imclass_method, String *class_method, String *imclass_desc, String *class_desc, String *decl) { UpcallData *addUpcallMethod(String *imclass_method, String *class_method, String *imclass_desc, String *class_desc, String *decl) {
UpcallData *udata;
String *imclass_methodidx;
String *class_methodidx;
Hash *new_udata;
String *key = NewStringf("%s|%s", imclass_method, decl); String *key = NewStringf("%s|%s", imclass_method, decl);
++curr_class_dmethod; ++curr_class_dmethod;
/* Do we know about this director class already? */ String *imclass_methodidx = NewStringf("%d", n_dmethods);
if ((udata = Getattr(dmethods_table, key))) { String *class_methodidx = NewStringf("%d", n_dmethods - first_class_dmethod);
Delete(key);
return Getattr(udata, "methodoff");
}
imclass_methodidx = NewStringf("%d", n_dmethods);
class_methodidx = NewStringf("%d", n_dmethods - first_class_dmethod);
n_dmethods++; n_dmethods++;
new_udata = NewHash(); Hash *new_udata = NewHash();
Append(dmethods_seq, new_udata); Append(dmethods_seq, new_udata);
Setattr(dmethods_table, key, new_udata); Setattr(dmethods_table, key, new_udata);