summaryrefslogtreecommitdiff
path: root/loaders
diff options
context:
space:
mode:
authorGarrett Regier <garrettregier@gmail.com>2015-01-05 11:37:59 -0800
committerGarrett Regier <garrettregier@gmail.com>2015-01-20 01:23:07 -0800
commitfea5963d3b6f6e3d22e125f593a855562629bea4 (patch)
tree451e921360074008bc747d7d065e32fd2fc07485 /loaders
parentf7f7a0ce63953c55eb5e7c9e515a622b767ae7b3 (diff)
downloadlibpeas-fea5963d3b6f6e3d22e125f593a855562629bea4.tar.gz
Always set the Lua loader's lua_State
This way we don't have to sprinkle lua_close() everytime initialize fails.
Diffstat (limited to 'loaders')
-rw-r--r--loaders/lua5.1/peas-plugin-loader-lua.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/loaders/lua5.1/peas-plugin-loader-lua.c b/loaders/lua5.1/peas-plugin-loader-lua.c
index 82184c9..bc926a2 100644
--- a/loaders/lua5.1/peas-plugin-loader-lua.c
+++ b/loaders/lua5.1/peas-plugin-loader-lua.c
@@ -466,7 +466,7 @@ peas_plugin_loader_lua_initialize (PeasPluginLoader *loader)
PeasPluginLoaderLuaPrivate *priv = GET_PRIV (lua_loader);
lua_State *L;
- L = luaL_newstate ();
+ priv->L = L = luaL_newstate ();
if (L == NULL)
{
g_critical ("Failed to allocate lua_State");
@@ -486,7 +486,6 @@ peas_plugin_loader_lua_initialize (PeasPluginLoader *loader)
LGI_MICRO_VERSION))
{
/* Already warned */
- lua_close (L);
return FALSE;
}
@@ -510,7 +509,6 @@ peas_plugin_loader_lua_initialize (PeasPluginLoader *loader)
priv->lgi_leave_func == NULL)
{
g_warning ("Failed to find 'lgi.lock', 'lgi.enter' and 'lgi.leave'");
- lua_close (L);
return FALSE;
}
@@ -521,8 +519,6 @@ peas_plugin_loader_lua_initialize (PeasPluginLoader *loader)
* release as we are not running Lua code
*/
priv->lgi_leave_func (priv->lgi_lock);
-
- priv->L = L;
return TRUE;
}