Proper (memory) handling of TreeModels



I have an application that, depending on a user's selection, filters the display of the base TreeModel (which is a liststore). The way I've been doing it is as follows:

Program initialization:  The base model (basemodel) is filled with data.

During execution: User selects a filter -> a new filtered model is generated with basemodel as the child and then a sort model is actually attached to the treeview for display, e.g.

filter_model = gtk_tree_model_filter_new( basemodel, NULL);
...
sort_model = gtk_tree_model_sort_new_with_model( filter_model );
...

There are many different views that can be selected so the above could be executed many times. What is the proper way to deal with the old filter_model and sort_model? Am I going about this in the wrong way?

I did it this way originally because it was simple and quick but now I'm refining my approach and realizing that this is probably leaking a ton of memory.

Thanks,

Matt







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