M
Martin Drautzburg
For reasons related to python/swig and garbage collecting I want to
remember every object in a linked list. I have a common base class
RCObj which in turn has a static std::list<RCObj*> memory.
My problem is that I cannot get RCObj store the true this pointer. Even
if I pass it explicitly from a derived class (called "Part") as in:
Part:art() {
this->RCObj::init(this);
the pointer that arrives at RCObj::init() is not the same as "this"
inside Part:art()
(gdb) p this
$4 = (pyramid:art * const) 0x81b62e0
(gdb) s
RCObj::init (this=0x81b6378, that=0x81b6378) at common.cc:65
I assume C++ treats an object as composed of several sections one of
which is the RCObj section and is silently add an offset (0x81b6378 -
0x81b62e0 = 152) to "this" if this shall be treated as an RCObj.
(1) what happens when I "delete this" from within the RCObj scope? Will
it only delete part of the object?
(2) how can I possibly keep track of all my created objects?
remember every object in a linked list. I have a common base class
RCObj which in turn has a static std::list<RCObj*> memory.
My problem is that I cannot get RCObj store the true this pointer. Even
if I pass it explicitly from a derived class (called "Part") as in:
Part:art() {
this->RCObj::init(this);
the pointer that arrives at RCObj::init() is not the same as "this"
inside Part:art()
(gdb) p this
$4 = (pyramid:art * const) 0x81b62e0
(gdb) s
RCObj::init (this=0x81b6378, that=0x81b6378) at common.cc:65
I assume C++ treats an object as composed of several sections one of
which is the RCObj section and is silently add an offset (0x81b6378 -
0x81b62e0 = 152) to "this" if this shall be treated as an RCObj.
(1) what happens when I "delete this" from within the RCObj scope? Will
it only delete part of the object?
(2) how can I possibly keep track of all my created objects?