Fixed x86-64 closing bug #44
authorMarijn van Vliet <marijn.vanvliet@med.kuleuven.be>
Sun, 18 Apr 2010 14:38:10 +0000 (14:38 +0000)
committerMarijn van Vliet <marijn.vanvliet@med.kuleuven.be>
Sun, 18 Apr 2010 14:38:10 +0000 (14:38 +0000)
git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@238 ddfedd41-794f-dd11-ae45-00112f111e67

libchimara/abort.c
libchimara/chimara-glk.c

index 8eb21dae91d53aaa13966624f1914def01037d00..79594089a920221d85ee79ff028dfbbd1e0b41bc 100644 (file)
@@ -46,7 +46,7 @@ abort_glk(void)
        shutdown_glk_pre();
        shutdown_glk_post();
        /* If program is terminated by g_thread_exit() instead of returning from the
-        glk_main() function, then the line in glk_enter() where the "stopped" 
+        glk_main() function, then the line in glk_exit() where the "stopped" 
         signal is emitted will not be reached. So we have to emit it here. */
        if(!glk_data->in_startup)
                g_signal_emit_by_name(glk_data->self, "stopped");
index e585165399415b7f6c6a1a49878b058b0186cc77..b6b88c742ebb1d33ebbbb38543ee6166dd087827 100644 (file)
@@ -579,11 +579,6 @@ chimara_glk_stopped(ChimaraGlk *self)
 {
     CHIMARA_GLK_USE_PRIVATE(self, priv);
     priv->running = FALSE;
-
-    /* Free the plugin */
-       if( priv->program && !g_module_close(priv->program) )
-           g_warning( "Error closing module: %s", g_module_error() );
-       priv->program = NULL;
 }
 
 static void
@@ -1159,8 +1154,12 @@ chimara_glk_run(ChimaraGlk *glk, const gchar *plugin, int argc, char *argv[], GE
        /* COMPAT: avoid usage of slices */
        struct StartupData *startup = g_new0(struct StartupData,1);
        
-    /* Open the module to run */
     g_assert( g_module_supported() );
+       /* If there is already a module loaded, free it first -- you see, we want to
+        * keep modules loaded as long as possible to avoid crashes in stack unwinding */
+       if( priv->program && !g_module_close(priv->program) )
+               g_warning( "Error closing module :%s", g_module_error() );
+       /* Open the module to run */
     priv->program = g_module_open(plugin, G_MODULE_BIND_LAZY);
     
     if(!priv->program)