Fix segfault attempting illegal javaclassname and csclassname special variable substitution

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@12058 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2010-05-26 19:01:12 +00:00
commit 7b2c6b477a
4 changed files with 24 additions and 4 deletions

View file

@ -101,3 +101,12 @@ Number times12(const Number* num) {
%inline %{
int myInt = 0;
%}
// Illegal special variable crash
%typemap(cstype) WasCrashing "$csclassname /*cstype $*csclassname*/" // $*csclassname was causing crash
%inline %{
struct WasCrashing {};
void hoop(WasCrashing was) {}
%}

View file

@ -63,3 +63,10 @@ class Farewell {};
Greeting* solong(Farewell* f) { return NULL; }
%}
// Illegal special variable crash
%typemap(jstype) WasCrashing "$javaclassname /*jstype $*javaclassname*/" // $*javaclassname was causing crash
%inline %{
struct WasCrashing {};
void hoop(WasCrashing was) {}
%}

View file

@ -3085,8 +3085,10 @@ public:
if (Strstr(tm, "$*csclassname")) {
SwigType *classnametype = Copy(strippedtype);
Delete(SwigType_pop(classnametype));
substituteClassnameSpecialVariable(classnametype, tm, "$*csclassname");
substitution_performed = true;
if (Len(classnametype) > 0) {
substituteClassnameSpecialVariable(classnametype, tm, "$*csclassname");
substitution_performed = true;
}
Delete(classnametype);
}
if (Strstr(tm, "$&csclassname")) {

View file

@ -2943,8 +2943,10 @@ public:
if (Strstr(tm, "$*javaclassname")) {
SwigType *classnametype = Copy(strippedtype);
Delete(SwigType_pop(classnametype));
substituteClassnameSpecialVariable(classnametype, tm, "$*javaclassname", jnidescriptor);
substitution_performed = true;
if (Len(classnametype) > 0) {
substituteClassnameSpecialVariable(classnametype, tm, "$*javaclassname", jnidescriptor);
substitution_performed = true;
}
Delete(classnametype);
}
if (Strstr(tm, "$&javaclassname")) {