luabind with boost::signals error

Szymon Gatner <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <[email protected]>
Hi,

I am trying to use luabind::object as a slot for boost::signal.

This code is perfectly fine:

  boost::signal<void(const std::string&)> sig;

  luabind::object slot = globals(lua)["slot"];

  sig.connect(slot);

  sig("signal call");

but a call to:

 sig.disconnect(slot);

throws a std::runtime_error("Trying to use unregistered class");

call stack:

 	KernelBase.dll!7717b727() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for
KernelBase.dll]
 	KernelBase.dll!7717b727() 	
 	msvcr90d.dll!_CxxThrowException(void * pExceptionObject=0x0020ece4,
const _s__ThrowInfo * pThrowInfo=0x00e18090)  Line 161	C++
>	playground.exe!luabind::detail::make_instance<std::auto_ptr<boost::function<void __cdecl(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)> > >(lua_State * L=0x000c01c0, std::auto_ptr<boost::function<void __cdecl(std::basic_string<char,std::char_traits<char>,std::allocator<char> > const &)> > p=auto_ptr {...})  Line 80 + 0x41 bytes	C++
 	playground.exe!luabind::detail::make_pointee_instance<boost::function<void
__cdecl(std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const &)> >(lua_State * L=0x000c01c0, boost::function<void
__cdecl(std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const &)> & x={...}, boost::mpl::bool_<0> __formal={...},
boost::mpl::bool_<0> __formal={...})  Line 183 + 0x21 bytes	C++
 	playground.exe!luabind::detail::make_pointee_instance<boost::function<void
__cdecl(std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const &)>,boost::mpl::bool_<1> >(lua_State * L=0x000c01c0,
boost::function<void
__cdecl(std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const &)> & x={...}, boost::mpl::bool_<1> __formal={...})  Line 195
+ 0x25 bytes	C++
 	playground.exe!luabind::detail::value_converter::apply<boost::function<void
__cdecl(std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const &)> >(lua_State * L=0x000c01c0, boost::function<void
__cdecl(std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const &)> x={...})  Line 281 + 0x1d bytes	C++
 	playground.exe!luabind::detail::push_aux<boost::function<void
__cdecl(std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const &)> const ,luabind::detail::default_policy>(lua_State *
interpreter=0x000c01c0, const boost::function<void
__cdecl(std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const &)> & value={...}, luabind::detail::default_policy *
__formal=0x00000000)  Line 73	C++
 	playground.exe!luabind::detail::push<boost::function<void
__cdecl(std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const &)> const ,luabind::detail::null_type>(lua_State *
interpreter=0x000c01c0, const boost::function<void
__cdecl(std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const &)> & value={...}, const luabind::detail::null_type &
__formal={...})  Line 83 + 0xf bytes	C++
 	playground.exe!luabind::detail::push<boost::function<void
__cdecl(std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const &)> const >(lua_State * interpreter=0x000c01c0, const
boost::function<void
__cdecl(std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const &)> & value={...})  Line 89 + 0x1c bytes	C++
 	playground.exe!luabind::adl::operator==<boost::function<void
__cdecl(std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const &)>,luabind::adl::object>(const boost::function<void
__cdecl(std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const &)> & lhs={...}, const luabind::adl::object & rhs={...})  Line
214 + 0xc9 bytes	C++
 	playground.exe!boost::signal1<void,std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const &,boost::last_value<void>,int,std::less<int>,boost::function<void
__cdecl(std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const &)> >::do_disconnect<luabind::adl::object>(const
luabind::adl::object & f={...}, boost::mpl::bool_<0> __formal={...})
Line 242 + 0xd bytes	C++
 	playground.exe!boost::signal1<void,std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const &,boost::last_value<void>,int,std::less<int>,boost::function<void
__cdecl(std::basic_string<char,std::char_traits<char>,std::allocator<char>
> const &)> >::disconnect<luabind::adl::object>(const
luabind::adl::object & t={...})  Line 225	C++
 	playground.exe!main()  Line 144	C++
 	playground.exe!__tmainCRTStartup()  Line 586 + 0x19 bytes	C
 	playground.exe!mainCRTStartup()  Line 403	C
 	kernel32.dll!759f3677() 	
 	ntdll.dll!77a89f02() 	
 	ntdll.dll!77a89ed5()

------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.