Fix bug where module will segfault on load if it contains an object w/ the same name as the module.

git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@10369 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
Xavier Delacour 2008-04-11 22:28:30 +00:00
commit 6878125b87
4 changed files with 20 additions and 1 deletions

View file

@ -13,7 +13,8 @@ srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
# CPP_TEST_CASES +=
CPP_TEST_CASES += \
samename
CPP_TEST_BROKEN += \
implicittest \

View file

@ -0,0 +1,13 @@
%module samename
%inline {
class samename {
public:
void do_something() {
// ...
}
};
}

View file

@ -0,0 +1 @@
samename

View file

@ -67,8 +67,12 @@ DEFUN_DLD (SWIG_name,args,nargout,SWIG_name_d) {
swig_install_ops(octave_swig_ref::static_type_id());
// the incref is necessary so install_global doesn't destroy module_ns,
// as it would if it installed something with the same name as the module.
module_ns->incref();
if (global_option)
module_ns->install_global();
module_ns->decref();
return octave_value_list();
}