[Glade-devel] dispose, finalize and close_impl methods not been called for glade_project

On Tue, 2011-01-11 at 01:22 -0300, Marco Diego Aur?lio Mesquita wrote:
Hi devs!

I'm working on some improvements for the preview feature[1] but I got
stuck. Glade must kill current running previews when a project is
closed, but, I don't know why, the finalize, dispose, and close_impl
methods are not been called. What is happening? What should I do?

The attached is part of my ongoing work on this issue. It's full of
debug printf's but shows that the finalize, dispose, and close_impl
methods are not been called.

I looked at the patch briefly, currently it still includes 
unneeded functions like glade_preview_kill_preview().

 - glade_preview_kill_preview() should be an implied exercise 
   by way of finalizing a GladePreview.
 - The hash table bookkeeping the running previews should
   hold the reference to the previews (i.e. the GDestroyNotify
   for the hash table of previews should be g_object_unref).
 - glade_preview_add_watch() should go away and the watch should
   be added internally by the preview object, and destroyed
   properly when the preview is unreffed.
 - If the preview is notified that the child preview process
   died, it should emit a "die" signal so that the GladeProject
   which owns the preview can use that to remove it from the
   hash table, resulting in it's dispose/finalize.

Please deal with these basic API/functionality issues first,
if the ref counts dont balance after that I'll help you take
a look at it and make sure that it finalizes properly.

 From GladeProject creating a preview should be:

 /* comes with initial ref */
 preview = glade_preview_launch (...);

 /* hash table takes a ref */
 g_hash_table_insert (project->priv->preview_hash, preview...);

 /* pass ownership of the preview to the hash table */
 g_object_unref (preview);

 /* Watch previews that die */
 g_signal_connect (preview, "die", 
                   G_CALLBACK (remove_preview_from_hash_cb),

... furthermore, the GDestroyNotify for the preview hash should
be a function that first disconnects the "die" signal callback
and *then* unrefs the preview.


[1] https://bugzilla.gnome.org/show_bug.cgi?id=637835
Glade-devel maillist  -  Glade-devel at lists.ximian.com

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