[libpeas] Always set the Lua loader's lua_State
- From: Garrett Regier <gregier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpeas] Always set the Lua loader's lua_State
- Date: Tue, 20 Jan 2015 09:24:12 +0000 (UTC)
commit fea5963d3b6f6e3d22e125f593a855562629bea4
Author: Garrett Regier <garrettregier gmail com>
Date: Mon Jan 5 11:37:59 2015 -0800
Always set the Lua loader's lua_State
This way we don't have to sprinkle lua_close()
everytime initialize fails.
loaders/lua5.1/peas-plugin-loader-lua.c | 6 +-----
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;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]