Fix bug 3529601 - seg fault when a protected method has the director

feature but the parent class does not. Also fix similar problems with
the allprotected feature.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@13135 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
William S Fulton 2012-05-29 22:02:43 +00:00
commit 7ec1e11604
6 changed files with 58 additions and 11 deletions

View file

@ -0,0 +1,27 @@
// Tests directors and allprotected option when the class does not have the "director" feature
// Was previously crashing and/or generating uncompilable code.
%module(directors="1", allprotected="1") allprotected_not
//%feature("director") AllProtectedNot;
%feature("director") AllProtectedNot::ProtectedMethod;
%feature("director") AllProtectedNot::StaticNonVirtualProtectedMethod;
%feature("director") AllProtectedNot::NonVirtualProtectedMethod;
%feature("director") AllProtectedNot::ProtectedVariable;
%feature("director") AllProtectedNot::StaticProtectedVariable;
%feature("director") AllProtectedNot::PublicMethod;
%inline %{
class AllProtectedNot {
public:
virtual ~AllProtectedNot() {}
virtual void PublicMethod() {}
protected:
virtual void ProtectedMethod() {}
static void StaticNonVirtualProtectedMethod() {}
void NonVirtualProtectedMethod() {}
int ProtectedVariable;
static int StaticProtectedVariable;
};
int AllProtectedNot::StaticProtectedVariable = 0;
%}

View file

@ -108,6 +108,7 @@ CPP_TEST_CASES += \
aggregate \
allowexcept \
allprotected \
allprotected_not \
anonymous_bitfield \
apply_signed_char \
apply_strings \