Re: Recommended way to cleanup your own gobject types in a desktop app (finalize and/or dispose)

2008-03-23 Thread Ali Sabil
Hello, iirc, the GObject documentation states that dispose may be called multiple times, and the object must still be usable even after dispose is called, so freeing memory in dispose is wrong, even with locks. Actually both dispose and finalize are needed if your object hold references to other

Re: Recommended way to cleanup your own gobject types in a desktop app (finalize and/or dispose)

2008-03-23 Thread Ali Sabil
Hmm, Now that I re read what I wrote, it seems like it was misleading, I didn't mean that the dispose should dereference other objects it holds more than once. Anyway, quoting the GObject tutorial : The dispose method is called when the object first knows it will be destroyed. It is supposed to

Re: Recommended way to cleanup your own gobject types in a desktop app (finalize and/or dispose)

2008-03-23 Thread Tristan Van Berkom
On Sun, Mar 23, 2008 at 8:00 AM, Ali Sabil [EMAIL PROTECTED] wrote: Hello, iirc, the GObject documentation states that dispose may be called multiple times, and the object must still be usable even after dispose is called, so freeing memory in dispose is wrong, even with locks.

Recommended way to cleanup your own gobject types in a desktop app (finalize and/or dispose)

2008-03-22 Thread Jaap A. Haitsma
Hi, When I look at projects like gnome-screensaver and gnome-power-manager I see that for their own created gobject types only the finalize function is implemented to cleanup the resources in the end of the application. gnome-volume-control uses only implements the dispose function I understand

Re: Recommended way to cleanup your own gobject types in a desktop app (finalize and/or dispose)

2008-03-22 Thread Philip Withnall
Hi, For Totem we use dispose to unref any objects and finalize to free any private memory and close any sockets/DB connections/other fluff, which is (I believe), how you're supposed to do it. If you only use dispose you'd have to put a lock variable in to stop any private memory getting freed