[Glade-devel] dispose, finalize and close_impl methods not been called for glade_project
Tristan Van Berkom
tristanvb at openismus.com
Tue Jan 11 05:27:53 EST 2011
On Tue, 2011-01-11 at 19:25 +0900, Tristan Van Berkom wrote:
> 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.
>
> Hint:
> 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);
>
Correction, you wouldn't need to unref the preview explicitly
here because above you give the initial ref to the hash table.
Cheers,
-Tristan
> /* Watch previews that die */
> g_signal_connect (preview, "die",
> G_CALLBACK (remove_preview_from_hash_cb),
> project);
>
>
> ... furthermore, the GDestroyNotify for the preview hash should
> be a function that first disconnects the "die" signal callback
> and *then* unrefs the preview.
>
> Cheers,
> -Tristan
>
> > [1] https://bugzilla.gnome.org/show_bug.cgi?id=637835
> > _______________________________________________
> > Glade-devel maillist - Glade-devel at lists.ximian.com
> > http://lists.ximian.com/mailman/listinfo/glade-devel
>
>
> _______________________________________________
> Glade-devel maillist - Glade-devel at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/glade-devel
More information about the Glade-devel
mailing list