Re: The use of RefPtr



On Sat, 07 Mar 2009 18:48:04 +0100
Murray Cumming <murrayc murrayc com> wrote:
> Eddie, presumably you are implementing a custom model (which will be
> difficult enough already), to avoid duplicating a large block of data
> inside the regular ListStore or TreeStore. And presumably it's this
> block of data that you don't want to allocate dynamically.
> 
> Can't you just do that and use a pointer to it from inside your
> TreeModel, rather than trying to change the memory management of the
> treemodel itself?
> 
> This isn't common enough or advantageous enough for us to try to
> support a different memory management system in gtkmm.

The tree view takes ownership of the tree model, so if the tree model
or the data it references is to be constructed on the stack as auto
data with local scope, either the tree view would also need to have
local scope or arrangements made to extract the model from the tree view
before the model and/or data ceases to be valid by going out of scope.

That means in turn that there could be no return to the GTK+ event loop
during the time that the tree model is available to the tree view
(unless there were to be recursive calls to Gtk::Main::run() on a
blocking dialog). This would be a very odd looking GTK+ program.

Chris


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