On Sun, Feb 08, 2004 at 11:21:41AM -0600, Paul Elliott wrote: > I have used the manage method in giving a page to a notebook. I have > changed my mind in this particular case. I now want the page back! > That is, I want to remove it without deleting it. If I call > set_manage(false) before removing it, will that do what I want? > I.e. remove it from the container without deleting it. > As far as I have been able to determine this will not work. You can not release an Object from the manage system once it has been added to a container as a managed object. Is this correct? However you can prevent the Object from being deleted by manipulating the manage refcounted system. If you call reference before removing the object from the container it will not be deleted. Until later when you want it to be deleted, you can let it be deleted by calling unreference. I was concerned that my unreference call might be bypassed by an exception, so I created this class to keep a Object alive until the holder is itself destroyed. class ObjectHolder // prevent Object from being deleted while I live! { private: Glib::Object * P; public: ObjectHolder(Glib::Object * O): P(O) { O->reference(); }; ~ObjectHolder() { P->unreference(); }; private: //disable do not define. ObjectHolder(); ObjectHolder(const ObjectHolder&); ObjectHolder& operator=(const ObjectHolder&); }; Is there an exiting class that will replace the above? I could not get Glib::RefPtr or SigC::Ptr to do it. Thank You. -- Paul Elliott 1(512)837-1096 pelliott io com PMB 181, 11900 Metric Blvd Suite J http://www.io.com/~pelliott/pme/ Austin TX 78758-3117
Attachment:
pgpEI8AzSNOcA.pgp
Description: PGP signature