Re: boxed types and copies
- From: Havoc Pennington <hp redhat com>
- To: Tim Janik <timj gtk org>
- Cc: Owen Taylor <otaylor redhat com>, Gtk+ Developers <gtk-devel-list gnome org>
- Subject: Re: boxed types and copies
- Date: 12 Dec 2000 21:34:26 -0500
Tim Janik <timj gtk org> writes:
> wait a second, first, g_signal_emit() uses GValue generically, apart from
> the obvious reasons of being able to deal with data generically, GValue
> makes sure that a reference count on its contents is being held while
> it exists. that boxed types sometimes copy themselves instead of reference
> counting themselves is a different issue, and more of an implementation detail
> of certain boxed types.
It's not an implementation detail, because it affects the user-visible
interface. It's an interface issue.
The obvious solution is that GValue can own or not own its object. If
it owns the object, then copying the value has to ref/unref the object
or copy the object by value. If the GValue does not own the object,
then it should assume there is some other owner, and ignore lifecycle
issues (no copies, no ref/unref).
The obvious way to implement that is a flag "owns_reference" or the
like in GValue. You can make room for the flag by changing the array
of unions to a single union. ;-)
Havoc
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]