Re: Wrong userdata pointer returned since update to luabind 0.9

Daniel Wallin <[email protected]>
Newsgroups gmane.comp.lang.lua.bind.user
Message-ID <[email protected]>
On Wed, Feb 24, 2010 at 02:51:40PM +0100, Stefan Reusch wrote:
> Here are the two functions...
[...]
> bool CLuaLabel::Create(luabind::object const& ParentWindow,
> luabind::table<luabind::object> const& Rect) {
> 	CRect r;
> 	CLuaWnd<>* pParent = NULL;
> 
> 	if(luabind::type(ParentWindow) == LUA_TUSERDATA) {
> 		pParent = luabind::touserdata<CLuaWnd<>>(ParentWindow);

This line doesn't extract the held C++ object. It should be something
like:

  pParent = luabind::object_cast<CLuaWnd<>*>(ParentWindow);

Assuming CLuaWnd is a registered base.

> The code has worked before i switched to luabind 0.9, but perhaps you
> has an idea what the problem is...

Are you sure this worked before? I don't see how it could.

-- 
Daniel Wallin
BoostPro Computing
http://www.boostpro.com

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
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.