Re: gperl_callback_invoke userdata copy
- From: muppet <scott asofyet org>
- To: Kevin Ryde <user42 zip com au>
- Cc: gtk-perl-list gnome org
- Subject: Re: gperl_callback_invoke userdata copy
- Date: Wed, 7 May 2008 23:30:44 -0400
On May 3, 2008, at 6:30 PM, Kevin Ryde wrote:
While nosing around for the tree filter modify callback I saw the
comment in gperl_callback_invoke about needing or not needing to copy
the userdata arg. I came up with the degenerate program below; it
unhooks the GtkLinkButton callback from within a callback, and the
userdata arg goes away,
userdata: ARRAY(0x83c131c)
Use of uninitialized value in print at t-callback-data.pl line 15.
userdata:
I wonder if it does, alas, have to do a copy to preserve the args
for a
case like that.
<t-callback-data.pl><GClosure.xs.invoke-copy.diff>
Luckily, the copy is fairly cheap.
I tried setting up a similar case with GLog handlers to create a unit
test, but GLog appear to keep the handlers alive across invocation to
avoid this issue. So, without writing C code for a test, i don't know
a way to unit test this.
With GtkLinkButton's hook, i don't think anybody ever expected a
callback would unregister itself.
It's safer and more correct to use the copy, so we should probably
commit it.
--
The one difference between Dali and a crazy man is very simple: Dali
is not crazy at all.
-- Salvador Dali
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]