[gtkmm] Re: reference counting vs. manage and local scoping



Disclaimer: I'm just beginning to learn gtkmm, and noticed this discussion - here are my 2 cents:
 
Why would widgets ever be referenced past the lifetimes of their containers?
 
I know this is more of a programming style issue, but this is a question of api design, so it's an important question. In my view, there's absolutely no reason a widget should exist after its container has been destroyed. The only people who are interested in this are those that couple their data to their widgets, which is bad design anyway. Isn't the data what should be reference-counted, not the widget?
 
On the other hand, I'm still not sure how things like lists and trees (where data decoupling is hardest) work in gtkmm - if I remember correctly, The data (model) is separate from the view. Can you manage() the view of a tree widget but reference count the model?
 
I think that if, for example, you need to have 2 dialogs open with the same tree widget, it's better to create two different widgets that connect to the same data than to create one widget that's referenced from two dialogs.
 
 
Thanks,
Yury


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