X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=src%2Fgc-finalized.h;h=738d37692f205bf618f2fa268d4174dfb4821349;hb=13ebe987b9a246ccd1a6d7968e1bf608fa497c56;hp=a31155653e69ba19f45146f82f27847639af3383;hpb=6b15695578f07a3f72c4c9475c1a261a3021472a;p=inkscape.git diff --git a/src/gc-finalized.h b/src/gc-finalized.h index a31155653..738d37692 100644 --- a/src/gc-finalized.h +++ b/src/gc-finalized.h @@ -40,22 +40,17 @@ namespace GC { * * The best way to limit this effect is to only make "leaf" objects * (i.e. those that don't point to other finalizaable objects) - * finalizable, or if the object also derives from GC::Managed<>, - * use GC::Managed<>::clearOnceInaccessible to register those links - * to be cleared once the object is made inacecssible (and before it's - * finalized). + * finalizable, and otherwise use GC::soft_ptr<> instead of a regular + * pointer for "backreferences" (e.g. parent pointers in a tree + * structure), so that those references can be cleared to break any + * finalization cycles. * - * In a tree structure that has parent links and finalized nodes, - * you will almost always want to do this with the parent links - * if you can't avoid having them. - * - * @see Inkscape::GC::Managed<>::clearOnceInaccessible - * @see Inkscape::GC::Managed<>::cancelClearOnceInacessible + * @see Inkscape::GC::soft_ptr<> * * 2. Because there is no guarantee when the collector will destroy * objects, there is no guarantee when the destructor will get called. * - * It may not get called until the very end of the program, or never. + * It may not get called until the very end of the program, or ever. * * 3. If allocated in arrays, only the first object in the array will * have its destructor called, unless you make other arrangements by @@ -119,9 +114,7 @@ public: private: /// invoke the destructor for an object given a base and offset pair - static void _invoke_dtor(void *base, void *offset) { - _unoffset(base, offset)->~Finalized(); - } + static void _invoke_dtor(void *base, void *offset); /// turn 'this' pointer into an offset-from-base-address (stored as void *) static void *_offset(void *base, Finalized *self) {