From 5aef673f75dae8caee456446640284db2daf525b Mon Sep 17 00:00:00 2001 From: Mark Gossage Date: Mon, 18 Sep 2006 05:44:22 +0000 Subject: [PATCH] fix on swiginit.swg, has been reported to crash on several test cases found and fixed problem in imports under python (mingw) git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9294 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- SWIG/Lib/swiginit.swg | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/SWIG/Lib/swiginit.swg b/SWIG/Lib/swiginit.swg index c196a8c01..8b568b22f 100644 --- a/SWIG/Lib/swiginit.swg +++ b/SWIG/Lib/swiginit.swg @@ -50,6 +50,7 @@ extern "C" { #define SWIGRUNTIME_DEBUG #endif + SWIGRUNTIME void SWIG_InitializeModule(void *clientdata) { size_t i; @@ -58,6 +59,14 @@ SWIG_InitializeModule(void *clientdata) { clientdata = clientdata; + /* check to see if the circular list has been setup, if not, set it up */ + if (swig_module.next==0) { + /* Initialize the swig_module */ + swig_module.type_initial = swig_type_initial; + swig_module.cast_initial = swig_cast_initial; + swig_module.next = &swig_module; + } + /* Try and load any already created modules */ module_head = SWIG_GetModule(clientdata); if (!module_head) { @@ -65,13 +74,6 @@ SWIG_InitializeModule(void *clientdata) { /* so set the swig module into the interpreter */ SWIG_SetModule(clientdata, &swig_module); module_head = &swig_module; - /* check to see if the circular list has been setup, if not, set it up */ - if (swig_module.next==0) { - /* Initialize the swig_module */ - swig_module.type_initial = swig_type_initial; - swig_module.cast_initial = swig_cast_initial; - swig_module.next = &swig_module; - } } else { /* the interpreter has loaded a SWIG module, but has it loaded this one? */ found=0;