[Xfce-bugs] [Bug 7100] xfce-spawn.c g_warning about setting marshaller twice

bugzilla-daemon at xfce.org bugzilla-daemon at xfce.org
Sat Jan 15 21:06:57 CET 2011


http://bugzilla.xfce.org/show_bug.cgi?id=7100

--- Comment #2 from Nick Schermer <nick at xfce.org> 2011-01-15 21:06:56 CET ---
Let me explain why a closure was chosen:

The spawn function have an unidentified life time, they can last for a split
second, but also for, say, 30 seconds. Because of that, a GObject setup (which
is also a bit overdue). I'm quite sure there was also a discussion about that
on ML at the time.

Because of that, the decision was made not to expose the structure (because
that would imply an (un)ref mechanism or free) for a signal. A callback needs a
_set function to unset it too (see below), but without returning structure this
is not possible.

Now there was also a limited use of applications in core the needed to know
when a spawn was finished; but if a spawn took too long, they were not
interested in the callback anymore.

This is exactly what you can do with a closure; the spawn code can ref and
trigger, the user can invalidate the close if its not required anymore.

Now the advantage for a callback or signal is that you can define a set of data
you return, in this case the exit code. This a closure you can do with, but you
sorta have to force a marshaller; so that's what we/I did.

Now you obviously only get the warning if you set the marshaller twice and we
never do that, so its not entirely 'wrong', if works fine if you don't abuse
it. So I wonder why you see this warning, because none is show in the code that
uses it right now.

What we could do is, if the close has a marshaller we don't set it (like you
suggested) and also not return the exit_code. I'm fine with that, but then the
exit code is never made public.

-- 
Configure bugmail: http://bugzilla.xfce.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the Xfce-bugs mailing list