From 59062a4b466283aedfe8a5858062b4cf759f0c93 Mon Sep 17 00:00:00 2001 From: Marijn van Vliet Date: Sun, 18 Apr 2010 14:38:10 +0000 Subject: [PATCH] Fixed x86-64 closing bug #44 git-svn-id: http://lassie.dyndns-server.com/svn/gargoyle-gtk@238 ddfedd41-794f-dd11-ae45-00112f111e67 --- libchimara/abort.c | 2 +- libchimara/chimara-glk.c | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/libchimara/abort.c b/libchimara/abort.c index 8eb21da..7959408 100644 --- a/libchimara/abort.c +++ b/libchimara/abort.c @@ -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"); diff --git a/libchimara/chimara-glk.c b/libchimara/chimara-glk.c index e585165..b6b88c7 100644 --- a/libchimara/chimara-glk.c +++ b/libchimara/chimara-glk.c @@ -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) -- 2.30.2