resume_function and errors

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

resume_function and errors

Jason McKesson
According to Lua's documentation, `lua_pcall` unwinds the stack after an
error. But `lua_resume` does *not*. Because of that, I keep hitting an
assert in the proxy function call destructor:

                 ~proxy_function_void_caller()
                 {
                     if (m_called) return;

                     m_called = true;
                     lua_State* L = m_state;

                     int top = lua_gettop(L);

                     push_args_from_tuple<1>::apply(L, m_args);
                     if (m_fun(L, boost::tuples::length<Tuple>::value, 0))
                     {
                         assert(lua_gettop(L) == top - m_params + 1);
#ifndef LUABIND_NO_EXCEPTIONS
                         throw luabind::error(L);
#else
                         error_callback_fun e = get_error_callback();
                         if (e) e(L);

                         assert(0 && "the lua function threw an error
and exceptions are disabled."
                                 " If you want to handle the error you
can use luabind::set_error_callback()");
                         std::terminate();
#endif
                     }
                     // pops the return values from the function call
                     stack_pop pop(L, lua_gettop(L) - top + m_params);
                 }

The assert itself seems to be pointless when using `resume` and
`resume_function`.

Is this a valid bug, or is there something else I should be doing when
using Lua threads?

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
luabind-user mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/luabind-user