Re: [Cluttermm] Use of Glib::RefPtr<T> vs. Gtkmm
- From: Murray Cumming <murrayc murrayc com>
- To: Aarto Matti <aarto matti gmail com>
- Cc: gtkmm-list gnome org
- Subject: Re: [Cluttermm] Use of Glib::RefPtr<T> vs. Gtkmm
- Date: Mon, 15 Mar 2010 17:22:29 +0100
On Mon, 2010-03-15 at 16:55 +0200, Aarto Matti wrote:
> Why Glib::RefPtr<T> is used in Clutter for smart-pointer management
> everywhere and Gtkmm doesn't bother about that much?
> We can create a button object with Gtk::Button *button =
> new Gtk::Button();
Clutter uses simple reference-counting for actors, I think.
GTK+ doesn't use simple reference-counting for widgets. Widgets are
typically owned by a container, and in gtkmm we also allow you to delete
it whenever you want.
> But we have to struggle in Clutter with that mess:
> Glib::RefPtr<Clutter::Actor> actor = new Clutter::Actor::create();
I don't like it much either, really.
I like that the use of the smartpointer makes the memory management
obvious. I would like to make such lines shorter somehow, while still
keeping them clear. It's something to explore for gtkmm 3.
> and not do like this:
> Clutter::Actor* actor = new Clutter::Actor();
Then you'd have to do manual reference/unreference like they do in C.
murrayc murrayc com
] [Thread Prev