[C++-sig] c++ object deleted

Renato Araujo renatox at gmail.com
Wed Nov 12 19:09:57 CET 2008


The main problem here is my parent control.

My object life is controlled by the parent life time:

somethin like that:

struct object
{
      object(object *parent)
      { parent.add_child(this); }

      ~object()

}



On Wed, Nov 12, 2008 at 2:14 PM, Stefan Seefeld <seefeld at sympatico.ca> wrote:
> Renato Araujo wrote:
>>
>> Hi all,
>>
>> Is possible in boost::python create a exception when the c++ object is
>> deleted internal, and you try use the python object. Because here I
>> got a core when I try do this.
>>
>
> I'm not sure whether it's technically possible, but I do believe this is a
> bad idea: Exceptions are just the wrong tool to deal with programming
> errors. Instead, you need to figure out what the expected lifetime of your
> object is and why it got deleted before. Once you understand this, modify
> your boost.python wrappers to use the appropriate return-value (or call)
> policies so this doesn't happen again.
>
> Regards,
>      Stefan
>
> --
>
>     ...ich hab' noch einen Koffer in Berlin...
>
> _______________________________________________
> Cplusplus-sig mailing list
> Cplusplus-sig at python.org
> http://mail.python.org/mailman/listinfo/cplusplus-sig
>



-- 
Renato Araujo Oliveira Filho


More information about the Cplusplus-sig mailing list