fix memory leaks in test

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8597 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Marcelo Matus 2006-01-28 19:18:47 +00:00
commit dde6392a0c
2 changed files with 14 additions and 0 deletions

View file

@ -13,6 +13,9 @@
%warnfilter(SWIGWARN_LANG_FRIEND_IGNORE) F; /* friend function */
%delobject F::destroy;
%delobject G::destroy;
%inline %{
/* A class with a public default constructor */
@ -92,6 +95,8 @@ private:
public:
void foo(int, int) { }
friend void bar(F *);
void destroy() { delete this; }
};
void bar(F *) { }
@ -109,6 +114,9 @@ class FFF : public F {
class G {
protected:
~G() { }
public:
void destroy() { delete this; }
};
class GG : public G {

View file

@ -81,6 +81,8 @@ try:
except AttributeError:
pass
dc.F_destroy(f)
ff = dc.new_FFF()
try:
del_ff = dc.delete_FFF
@ -88,6 +90,8 @@ try:
except AttributeError:
pass
dc.F_destroy(ff)
g = dc.new_G()
try:
@ -96,6 +100,8 @@ try:
except AttributeError:
pass
dc.G_destroy(g)
gg = dc.new_GG()
dc.delete_GG(gg)