Re: [gtkmm] TreeView Model, SEGV on append



On 2003.11.11 18:53, "Ohrnberger, Erik" wrote:
Are both of these means for constructing Gtk containing and Gtk
subclassed object instances valid?

Yes.

Can both of these methods be used at the same time?  What I mean to
say is that a containing class may be dynamic, while some of it's contained widgets may be either dynamic or automatic (second example).

Yes again. This is no different than ordinary memory management in C++. The only thing that is new is the manage() function, that makes the widget's container responsible for deleting it. If the tmpNotebook is a member, you could just as well delete it in the destructor, or better yet, use auto_ptr.

Is there any particular advantage in doing it one way over the other?
If so, what would it be?  Is it just for the sake of consistency?

If you use dynamic memory you don't have to declare it as a member. This is useful for things such as labels. If you need to access the widget later, you have to declare it as a member. You could still declare it as a pointer though, in case you want to forward declare it's class, so you don't have to include an extra gtkmm header in your header file.

/Fredrik Arnerup



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]