Re: [[gtkmm] technical question: GTKMM_LIFECYCLE]

MHL Schulze t-online de (Martin Schulze) wrote:
> Hi!
> In the process of wrapping gstreamer a few questions regarding
> the lifecylce management code of gtkmm popped up.
> In the current implementation of Gtk::Object the following behaviour
> doesn't seem to be 100% consistent (first scenario):
> - Why do we force a gtk_object_destroy() in the c++ instance's dtor
>    when it hasn't been manage()ed (i.e. referenced_ == true)?
>    Why don't we ensure that we simply remove all the references that
>    have been created from our c++ wrappers instead?

Because the C instance should be destroyed when the C++ instance is deleted.
Why would you want a more complicated memory model?

> - gtkmm objects that were not manage()ed are reference counted non
>    the less. However, when the reference counter reaches zero the
>    c object is deleted but the c++ instance is not (only gobject_ is
>    set to 0).

No, whenever a C object is destroyed, the C++ instance _will_ be deleted. It
might not be obvious how that happens, though I have tried to add verbose and
repetitive comments about that kind of thing.

I'll ignore the rest of your comments because they seem to depend on that

Murray Cumming
murrayc usa net

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