Re: TextTag and TextTagTable deallocation



On Thu, 2007-05-17 at 11:39 +0200, angelo wrote:
> hi all,
> 
> i need some explanation on how to deallocate the objects allocated by 
> the static methods "create".
> Since a refptr is used, there should probably no need for deallocate 
> them, but i can't really understand this mechanism.

Yes, it's that simple. You don't need to explicitly deallocate objects
that are used via RefPtr.

But this question is more about how the TextBuffer uses Tags.

> I load some settings at the start of my application. After a settings 
> "apply", i have to recreate new tags, and reload the tag table with new 
> tags.
> For now, i'm creating every time new tags Gtk::TextTag::create(); and 
> adding them to a new tag table Gtk::TextTagTable::create();, but i need 
> to know if i need to deallocate the previous created tags and tagtable 
> objects.

If you would like to avoid creating a new TextTagTable, if you think
that would be more efficient, and if it is possible because there are
not so many changes, you could just remember the TextTags and change
them via the TextTag methods.
http://gtkmm.org/docs/gtkmm-2.4/docs/reference/html/classGtk_1_1TextTag.html

But if you create new tags, I don't know whether the TextBuffer will use
a new tag just because it has the same name as a previously-used tag.
You might need that. A small test case should show if it works.

-- 
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]