Re: GObjectClass.dispose and bringing objects back to life

2011-12-06 Thread Stefan Sauer
On 12/04/2011 05:03 PM, David Nečas wrote: On Sun, Dec 04, 2011 at 01:40:58PM +, Emmanuele Bassi wrote: this is, of course, not true: GNOME is full of badly written GObject code, mostly because it has been written at various stages of the learning process of various people. plus, the

Re: GObjectClass.dispose and bringing objects back to life

2011-12-04 Thread Emmanuele Bassi
hi; On 4 December 2011 13:23, Benjamin Otte o...@gnome.org wrote: Tristan Van Berkom tvb at gnome.org writes: Yes, real-world well-written GObjects *must* not crash after being disposed, code that crashes because apis are called after dispose time are bugs, and you should fix them as

Re: GObjectClass.dispose and bringing objects back to life

2011-12-04 Thread Morten Welinder
What we probably also should do is deprecate one of the two virtual functions, so people use the same one to clean up everywhere. That would be a _really_ bad idea. _finalize gets rid of the last fragments of the object. Since random code could have obtained refs to the object, the object

Re: GObjectClass.dispose and bringing objects back to life

2011-12-04 Thread David Nečas
On Sun, Dec 04, 2011 at 01:40:58PM +, Emmanuele Bassi wrote: this is, of course, not true: GNOME is full of badly written GObject code, mostly because it has been written at various stages of the learning process of various people. plus, the documentation is not entirely clear in a lot

Re: GObjectClass.dispose and bringing objects back to life

2011-12-04 Thread Tristan Van Berkom
2011/12/5 David Nečas y...@physics.muni.cz: On Sun, Dec 04, 2011 at 01:40:58PM +, Emmanuele Bassi wrote: this is, of course, not true: GNOME is full of badly written GObject code, mostly because it has been written at various stages of the learning process of various people. plus, the

Re: GObjectClass.dispose and bringing objects back to life

2011-12-04 Thread Benjamin Otte
I would be somewhat tempted to listen to all the stuff you're saying below. But then I looked at the code you maintain[1], and I realized it doesn't do anything of that. So I'm inclined to think that what you're talking about is more about an ideal world that you wish we all aspired to, but is not

Re: GObjectClass.dispose and bringing objects back to life

2011-12-04 Thread Morten Welinder
Benjamin Otte o...@gnome.org wrote: But then I looked at [gnumeric] and I realized it doesn't do anything of that. So I'm inclined to think that what you're talking about is more about an ideal world that you wish we all aspired to, but is not in any way related to how people write code in

Re: GObjectClass.dispose and bringing objects back to life

2011-12-02 Thread Dan Winship
On 12/02/2011 07:55 AM, Tristan Van Berkom wrote: o References to other GObjects are broken in dispose, and since dispose can run multiple times, care must be taken, i.e.: if (priv-reffed_object != NULL) { g_object_unref (priv-reffed_object); priv-reffed_object

Re: GObjectClass.dispose and bringing objects back to life

2011-12-02 Thread Simon McVittie
On Fri, 02 Dec 2011 at 15:55:18 +0900, Tristan Van Berkom wrote: Yes, real-world well-written GObjects *must* not crash after being disposed, code that crashes because apis are called after dispose time are bugs, and you should fix them as specially if you have possible circular object

GObjectClass.dispose and bringing objects back to life

2011-12-01 Thread Simon McVittie
Hi, I've been looking into the details of how GObjects are destroyed, hoping to solve https://bugzilla.gnome.org/show_bug.cgi?id=665211, in which disposing a global singleton GDBusConnection in one thread races with reffing and using it in another thread, causing resurrection and a crash if both

Re: GObjectClass.dispose and bringing objects back to life

2011-12-01 Thread Ryan Lortie
On Thu, 2011-12-01 at 19:26 +, Simon McVittie wrote: Hi, I've been looking into the details of how GObjects are destroyed, hoping to solve https://bugzilla.gnome.org/show_bug.cgi?id=665211, in which disposing a global singleton GDBusConnection in one thread races with reffing and using it

Re: GObjectClass.dispose and bringing objects back to life

2011-12-01 Thread Tristan Van Berkom
On Fri, Dec 2, 2011 at 4:26 AM, Simon McVittie simon.mcvit...@collabora.co.uk wrote: Hi, I've been looking into the details of how GObjects are destroyed, hoping to solve https://bugzilla.gnome.org/show_bug.cgi?id=665211, in which disposing a global singleton GDBusConnection in one thread