[libpeas] Set atpanic handler early in Lua plugin loader



commit f7f7a0ce63953c55eb5e7c9e515a622b767ae7b3
Author: Garrett Regier <garrettregier gmail com>
Date:   Mon Jan 5 11:13:23 2015 -0800

    Set atpanic handler early in Lua plugin loader
    
    Before if a panic occurred in the initialization code it
    would go to the original atpanic handler.

 loaders/lua5.1/peas-plugin-loader-lua.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)
---
diff --git a/loaders/lua5.1/peas-plugin-loader-lua.c b/loaders/lua5.1/peas-plugin-loader-lua.c
index 270a680..82184c9 100644
--- a/loaders/lua5.1/peas-plugin-loader-lua.c
+++ b/loaders/lua5.1/peas-plugin-loader-lua.c
@@ -473,6 +473,10 @@ peas_plugin_loader_lua_initialize (PeasPluginLoader *loader)
       return FALSE;
     }
 
+  /* Set before any other code is run */
+  if (g_getenv ("PEAS_LUA_DEBUG") != NULL)
+    lua_atpanic (L, atpanic_handler);
+
   luaL_openlibs (L);
 
   if (!peas_lua_utils_require (L, "lgi") ||
@@ -513,11 +517,6 @@ peas_plugin_loader_lua_initialize (PeasPluginLoader *loader)
   /* Pop lgi's module table */
   lua_pop (L, 1);
 
-  if (g_getenv ("PEAS_LUA_DEBUG") != NULL)
-    {
-      lua_atpanic (L, atpanic_handler);
-    }
-
   /* Initially the lock is taken by LGI,
    * release as we are not running Lua code
    */


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]