[libpeas] Fix panic when getting global LGI fields
- From: Garrett Regier <gregier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpeas] Fix panic when getting global LGI fields
- Date: Tue, 30 Dec 2014 17:47:25 +0000 (UTC)
commit 0c31653a6db8f21faf7ee7a7bfa28734834e033c
Author: Garrett Regier <garrett regier riftio com>
Date: Tue Dec 30 09:20:32 2014 -0800
Fix panic when getting global LGI fields
A panic will occur when using lua_getfield() as LGI
will attempt to find the value as a typelib. This breaks
the attempt to report an incorrect LGI version and
causes a crash.
loaders/lua5.1/peas-plugin-loader-lua.c | 9 ++++++---
1 files changed, 6 insertions(+), 3 deletions(-)
---
diff --git a/loaders/lua5.1/peas-plugin-loader-lua.c b/loaders/lua5.1/peas-plugin-loader-lua.c
index b98db05..d5464d0 100644
--- a/loaders/lua5.1/peas-plugin-loader-lua.c
+++ b/loaders/lua5.1/peas-plugin-loader-lua.c
@@ -486,15 +486,18 @@ peas_plugin_loader_lua_initialize (PeasPluginLoader *loader)
return FALSE;
}
- lua_getfield (L, -1, "lock");
+ lua_pushliteral (L, "lock");
+ lua_rawget (L, -2);
priv->lgi_lock = lua_touserdata (L, -1);
lua_pop (L, 1);
- lua_getfield (L, -1, "enter");
+ lua_pushliteral (L, "enter");
+ lua_rawget (L, -2);
priv->lgi_enter_func = lua_touserdata (L, -1);
lua_pop (L, 1);
- lua_getfield (L, -1, "leave");
+ lua_pushliteral (L, "leave");
+ lua_rawget (L, -2);
priv->lgi_leave_func = lua_touserdata (L, -1);
lua_pop (L, 1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]