Re: add_dependency assert problem
锋 <[email protected]> Fri, 19 Aug 2011 17:30:47 +0800
| Newsgroups | gmane.comp.lang.lua.bind.user |
|---|---|
| Message-ID | <CAEMQFeXmTs9wJ5RTopvwSpLRYPL8JJY16MakzMwuj_9UTT7a8A@mail.gmail.com> |
thanks for Ryan Pavlik reply.
define virtual destructor in class base can't resolve this problem.
i am not know the luabind-inside work well, it looks like luabind hold the
'object_rep'(b.member), every time call the b.member in lua will use the
same 'object_rep'. so the m_dependency_cnt is overflow.
how should i avoid it ? (not define the base print function with 'virtual'
or remove any one('derived_warp', 'base') in the ' class_<derived,
derived_warp, base>("derived") ' well be ok, but the "derived" in lua will
not meet my needs)
------------------------------
>
> Message: 6
> Date: Wed, 17 Aug 2011 09:52:45 -0500
> From: Ryan Pavlik <[email protected]>
> Subject: Re: [luabind] add_dependency assert problem
> To: [email protected]
> Message-ID:
> <CABMFTE8-AJ+ha34QWd+xAKRJZrv72wGEEg=ZyGVyfzD=vddcQg@mail.gmail.com
> >
> Content-Type: text/plain; charset="utf-8"
>
> Try this: Define a virtual destructor in class base. It can be trivial:
> that
> is, ~base() {}
>
>
> On Wed, Aug 17, 2011 at 5:22 AM, ? <[email protected]> wrote:
>
> > hi, all:
> >
> > i get *assertion* error in *object_rep*.cpp -- "assert(m_dependency_cnt <
> > sizeof(object_rep));" when i use luabind like this example:
> >
> > ----------------------
> >
> > class base
> > {
> > public:
> > virtual void print() {} // if not use 'virtual', the
> > m_dependency_cnt will not bigger than sizeof(object_rep)
> > };
> >
> > class derived : public base {};
> > class derived_wrap : public derived, public wrap_base {};
> >
> > class holder
> > {
> > public:
> > base* member;
> >
> > holder(base* p) : member(p) {}
> > };
> >
> > module(L)
> > [
> > class_<base>("base")
> > .def(constructor<>())
> > .def("print", &base::print),
> >
> > class_<derived, derived_wrap, base>("derived") // i want the
> > "derived" in lua can be derived and also have base class "print" function
> > .def(constructor<>()),
> >
> > class_<holder>("holder")
> > .def(constructor<base*>())
> > .def_readonly("member", &holder::member)
> > ];
> >
> > luaL_dostring(L,
> > "a = derived() "
> > "b = holder(a) "
> > "for i = 1, 100 do "
> > " b.member:print() "
> > "end "
> > );
> >
> > ----------------------
> >
> > any ideas? thanks in advance
> >
> > onlyfeng
> > [email protected]
> >
> >
> >
> >
> ------------------------------------------------------------------------------
> > Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
> > user administration capabilities and model configuration. Take
> > the hassle out of deploying and managing Subversion and the
> > tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
> > _______________________________________________
> > luabind-user mailing list
> > [email protected]
> > https://lists.sourceforge.net/lists/listinfo/luabind-user
> >
> >
>
>
> --
> Ryan Pavlik
> HCI Graduate Student
> Virtual Reality Applications Center
> Iowa State University
>
> [email protected]
> http://academic.cleardefinition.com
> -------------- next part --------------
> An HTML attachment was scrubbed...
>
> ------------------------------
>
------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
user administration capabilities and model configuration. Take
the hassle out of deploying and managing Subversion and the
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
luabind-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/luabind-user