Re: memory management
- From: "Murray Cumming" <murrayc murrayc com>
- To: "Kresimir Culin" <kresimir culin zd htnet hr>
- Cc: gtkmm-list gnome org
- Subject: Re: memory management
- Date: Wed, 8 Dec 2004 22:14:41 +0100 (CET)
> Thank you for answering my e-mail.
> I followed the links you have send me, but it seems to me manage() can
> be aplied only to
> widgets with container as parent.
>
> I want to know if I can do something similar with any Glib/Gtk class.
No, it only works for Gtk::Widgets.
> I saw Gtk::Object has is manage() method.
>
> class Foo
> : public Gtk::Object
> {
> public:
> Foo() : Gtk::Object(NULL)
> {
> };
> ~Foo()
> {
> std::cout << "destruktor" <<std::endl;
> };
> void add(Gtk::Object * obj)
> {
> manage(obj);
> }
> };
>
> Foo a, *b;
> b = new Foo();
> a.add(b);
>
>
> This code will compile.
> Gtk::object has manage() method.
> but (Foo a) destructor won't delete b object.
>
>
>
>
>
>
>
> Murray Cumming wrote:
>
>>On Tue, 2004-12-07 at 23:32 +0100, Kresimir Culin wrote:
>>
>>
>>>Does Gtk::Object or Glib::Object or some other class
>>>suport
>>>
>>>add_child_object(Gtk::Object * obj)
>>>
>>>or something similar.
>>>
>>>I don't understand what manage() does,
>>> maybe I could use manage.
>>>
>>>I need parent object (high in object tree as possible)
>>>that can free child objects when deleted.
>>>
>>>
>>
>>"What does Gtk::manage() do?":
>>http://www.gtkmm.org/docs/gtkmm-2.4/docs/FAQ/html/index.html#id2543216
>>
>>Memory Management - Managed Widgets:
>>http://www.gtkmm.org/docs/gtkmm-2.4/docs/tutorial/html/ch18.html#id2637805
>>
>>
>>
>
>
Murray Cumming
murrayc murrayc com
www.murrayc.com
www.openismus.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]