[svn-commits] russell: trunk r317477 - in /trunk: ./ pbx/pbx_lua.c

SVN commits to the Digium repositories svn-commits at lists.digium.com
Thu May 5 17:49:41 CDT 2011


Author: russell
Date: Thu May  5 17:49:36 2011
New Revision: 317477

URL: http://svnview.digium.com/svn/asterisk?view=rev&rev=317477
Log:
Merged revisions 317476 via svnmerge from 
https://origsvn.digium.com/svn/asterisk/branches/1.8

........
  r317476 | russell | 2011-05-05 17:47:57 -0500 (Thu, 05 May 2011) | 8 lines
  
  Add a datastore fixup to fix a pbx_lua crash.
  
  (closes issue #19055)
  Reported by: jamhed
  Patches:
        lua_datastore_fixup1.diff uploaded by mnicholson (license 96)
  Tested by: mnicholson, jamhed
........

Modified:
    trunk/   (props changed)
    trunk/pbx/pbx_lua.c

Propchange: trunk/
------------------------------------------------------------------------------
Binary property 'branch-1.8-merged' - no diff available.

Modified: trunk/pbx/pbx_lua.c
URL: http://svnview.digium.com/svn/asterisk/trunk/pbx/pbx_lua.c?view=diff&rev=317477&r1=317476&r2=317477
==============================================================================
--- trunk/pbx/pbx_lua.c (original)
+++ trunk/pbx/pbx_lua.c Thu May  5 17:49:36 2011
@@ -86,6 +86,7 @@
 static void lua_create_hangup_function(lua_State *L);
 
 static void lua_state_destroy(void *data);
+static void lua_datastore_fixup(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan);
 static lua_State *lua_get_state(struct ast_channel *chan);
 
 static int exists(struct ast_channel *chan, const char *context, const char *exten, int priority, const char *callerid, const char *data);
@@ -103,6 +104,7 @@
 static const struct ast_datastore_info lua_datastore = {
 	.type = "lua",
 	.destroy = lua_state_destroy,
+	.chan_fixup = lua_datastore_fixup,
 };
 
 
@@ -113,6 +115,21 @@
 {
 	if (data)
 		lua_close(data);
+}
+
+/*!
+ * \brief The fixup function for the lua_datastore.
+ * \param data the datastore data, in this case it will be a lua_State
+ * \param old_chan the channel we are moving from
+ * \param new_chan the channel we are moving to
+ *
+ * This function updates our internal channel pointer.
+ */
+static void lua_datastore_fixup(void *data, struct ast_channel *old_chan, struct ast_channel *new_chan)
+{
+	lua_State *L = data;
+	lua_pushlightuserdata(L, new_chan);
+	lua_setfield(L, LUA_REGISTRYINDEX, "channel");
 }
 
 /*!




More information about the svn-commits mailing list