Re: Fwd: Re: GTK_FLOATING broken in 2.9?
- From: Yevgen Muntyan <muntyan tamu edu>
- To: Gtk+ Developers <gtk-devel-list gnome org>
- Subject: Re: Fwd: Re: GTK_FLOATING broken in 2.9?
- Date: Thu, 15 Dec 2005 06:52:57 -0600
Tim Janik wrote:
On Thu, 15 Dec 2005, Yevgen Muntyan wrote:
ANDREW PAPROCKI, BLOOMBERG/ 731 LEXIN wrote:
When you are calling your own code, it is not that much to keep
track of, but when I write code that is used by 1000 developers it
is much easier for me to take care of the reference issues inside
the API and make the large group of unknown developers free from
unknowingly creating reference counting bugs.
So, the thousands of another developers now will have to check
documentation for any GObject-derived class to figure out whether
they own reference or not. This is exactly why it's good when you
invent your wrappers, where it's clear that wrapper is made for
purpose and one might be interested in what that wrapper does.
So, if before the usage pattern was:
object = create_object ();
...
g_object_unref (object); /* I do know I own it */
now it will be
object = create_object ();
g_object_ref_sink (object); /* who knows what will happen in ... */
...
g_object_unref (object);
for the most part, users will not need to sink objects.
it's language bindings and container implementations that do this.
the floating flag is actually meant to make it easier on the user as
outlined in:
http://developer.gnome.org/doc/API/2.0/gobject/gobject-The-Base-Object-Type.html#floating-ref
and for historic heritage see:
gtk+/docs/refcounting.txt
These arguments about bugs and stuff are good arguments about why
one should use C++ or whatever other language with some sort of
automatic
memory management.
this is absolutely correct. reall OO applications should be written in
languages with native OO support. for the scope of glib, gobject and
gtk+, we're stuck with maintaining an
OO system implemented in C though, and we're simply doing our best to
live up to that expectation.
C is known not to be safe, and it's known that you
must be careful. After introducing floating references one will still
need
to be as careful, but he also will need to check one more thing -
floating
reference (or sink it as soon as possible).
no, you can treat a GObject with floating reference support the same way
you treat GObjects in older glib versions, as if it had no floating ref
support.
Maybe real solution would be for those 1000 guys to use mono or
something?
unfortunately this always depends on other project aspects, like the
platform
and programming skills. the deployment plans, etc. etc.
Regards,
Yevgen
---
ciaoTJ
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]