From: <kw...@us...> - 2012-04-15 22:47:25
|
Revision: 12994 http://swig.svn.sourceforge.net/swig/?rev=12994&view=rev Author: kwwette Date: 2012-04-15 22:47:19 +0000 (Sun, 15 Apr 2012) Log Message: ----------- Fixed segfault-on-exit in octave 3.2.4 - see SourceForge #3516652 Modified Paths: -------------- trunk/Lib/octave/octruntime.swg Modified: trunk/Lib/octave/octruntime.swg =================================================================== --- trunk/Lib/octave/octruntime.swg 2012-04-15 21:56:38 UTC (rev 12993) +++ trunk/Lib/octave/octruntime.swg 2012-04-15 22:47:19 UTC (rev 12994) @@ -171,7 +171,9 @@ // exiting without explicitly clearing the variable causes octave to segfault. #if OCTAVE_API_VERSION_NUMBER>=37 octave_value_list SWIG_atexit_func(const octave_value_list &args, int nargout) { - symbol_table::clear_global_pattern("*"); + string_vector vars = symbol_table::global_variable_names(); + for (int i = 0; i < vars.length(); i++) + symbol_table::clear_global(vars[i]); symbol_table::clear_functions(); return octave_value(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kw...@us...> - 2012-05-23 09:32:48
|
Revision: 13107 http://swig.svn.sourceforge.net/swig/?rev=13107&view=rev Author: kwwette Date: 2012-05-23 09:32:38 +0000 (Wed, 23 May 2012) Log Message: ----------- [octave] Make sure SWIG_global_name is a std::string for comparison Modified Paths: -------------- trunk/Lib/octave/octruntime.swg Modified: trunk/Lib/octave/octruntime.swg =================================================================== --- trunk/Lib/octave/octruntime.swg 2012-05-23 04:05:11 UTC (rev 13106) +++ trunk/Lib/octave/octruntime.swg 2012-05-23 09:32:38 UTC (rev 13107) @@ -198,7 +198,7 @@ SWIG_Octave_InstallFunction(me, "subclass"); octave_swig_type* cvar_ns=0; - if (SWIG_global_name != ".") { + if (std::string(SWIG_global_name) != ".") { cvar_ns=new octave_swig_type; for (int j=0;swig_globals[j].name;++j) if (swig_globals[j].get_method) @@ -206,7 +206,7 @@ } module_ns=new octave_swig_type(0, 0, 0, true); - if (SWIG_global_name != ".") { + if (std::string(SWIG_global_name) != ".") { module_ns->assign(SWIG_global_name,Swig::swig_value_ref(cvar_ns)); } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kw...@us...> - 2012-07-12 17:53:08
|
Revision: 13318 http://swig.svn.sourceforge.net/swig/?rev=13318&view=rev Author: kwwette Date: 2012-07-12 17:53:02 +0000 (Thu, 12 Jul 2012) Log Message: ----------- octave: use _Exit instead of _exit - _exit is a POSIX function (unistd.h), whereas _Exit is in C99 (stdlib.h) and is therefore more likely to be supported by C++ compilers (cstdlib) Modified Paths: -------------- trunk/Lib/octave/octruntime.swg Modified: trunk/Lib/octave/octruntime.swg =================================================================== --- trunk/Lib/octave/octruntime.swg 2012-07-12 17:02:04 UTC (rev 13317) +++ trunk/Lib/octave/octruntime.swg 2012-07-12 17:53:02 UTC (rev 13318) @@ -132,8 +132,9 @@ #ifdef SWIG_OCTAVE_SEGFAULT_HACK #define _SWIG_OCT_SEGF_HACK_ATEXIT_FCN(NAME) SWIG_OCT_SEGF_HACK_ATEXIT_FCN_##NAME #define SWIG_OCT_SEGF_HACK_ATEXIT_FCN(NAME) _SWIG_OCT_SEGF_HACK_ATEXIT_FCN(NAME) +#include <cstdlib> void SWIG_OCT_SEGF_HACK_ATEXIT_FCN(SWIG_name)(void) { - _exit(exit_status); + _Exit(exit_status); } #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <kw...@us...> - 2012-07-20 07:31:42
|
Revision: 13336 http://swig.svn.sourceforge.net/swig/?rev=13336&view=rev Author: kwwette Date: 2012-07-20 07:31:32 +0000 (Fri, 20 Jul 2012) Log Message: ----------- octave: improved segfault-on-exit prevention hack - Now simply set exit function pointer "octave_exit" to _Exit. This correctly preserves exit status when error() is called. Modified Paths: -------------- trunk/Lib/octave/octruntime.swg Modified: trunk/Lib/octave/octruntime.swg =================================================================== --- trunk/Lib/octave/octruntime.swg 2012-07-19 16:08:11 UTC (rev 13335) +++ trunk/Lib/octave/octruntime.swg 2012-07-20 07:31:32 UTC (rev 13336) @@ -1,4 +1,5 @@ %insert(runtime) %{ +#include <cstdlib> #include <iostream> #include <octave/oct.h> #include <octave/Cell.h> @@ -120,24 +121,6 @@ return octave_value(octave_uint64((unsigned long long) ost->swig_this())); } -// workaround to prevent octave seg-faulting on exit: register at-exit -// function which exits octave immediately without trying to cleanup memory. -// definitely affects version 3.2.*, not sure about 3.3.*, seems to be -// fixed in version 3.4.* and above. can be turned on/off with macros. -#ifndef SWIG_OCTAVE_NO_SEGFAULT_HACK -#if 36 < OCTAVE_API_VERSION_NUMBER && OCTAVE_API_VERSION_NUMBER < 45 -#define SWIG_OCTAVE_SEGFAULT_HACK -#endif -#endif -#ifdef SWIG_OCTAVE_SEGFAULT_HACK -#define _SWIG_OCT_SEGF_HACK_ATEXIT_FCN(NAME) SWIG_OCT_SEGF_HACK_ATEXIT_FCN_##NAME -#define SWIG_OCT_SEGF_HACK_ATEXIT_FCN(NAME) _SWIG_OCT_SEGF_HACK_ATEXIT_FCN(NAME) -#include <cstdlib> -void SWIG_OCT_SEGF_HACK_ATEXIT_FCN(SWIG_name)(void) { - _Exit(exit_status); -} -#endif - static const char *const SWIG_name_usage = "-*- texinfo -*- \n\ @deftypefn {Loadable Module} {} " SWIG_name_d "\n\ Loads the SWIG-generated module `" SWIG_name_d "'.\n\ @@ -164,9 +147,15 @@ // create module on first function call if (!module_ns) { -#ifdef SWIG_OCTAVE_SEGFAULT_HACK - atexit(SWIG_OCT_SEGF_HACK_ATEXIT_FCN(SWIG_name)); + // workaround to prevent octave seg-faulting on exit: set Octave exit function + // octave_exit to _Exit, which exits immediately without trying to cleanup memory. + // definitely affects version 3.2.*, not sure about 3.3.*, seems to be + // fixed in version 3.4.* and above. can be turned off with macro def. +#ifndef SWIG_OCTAVE_NO_SEGFAULT_HACK +#if 36 < OCTAVE_API_VERSION_NUMBER && OCTAVE_API_VERSION_NUMBER < 45 + octave_exit = ::_Exit; #endif +#endif // workaround bug in octave where installing global variable of custom type and then // exiting without explicitly clearing the variable causes octave to segfault. This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |