Re: gperl_callback_invoke userdata copy

Torsten Schoenfeld <kaffeetisch gmx de> writes:

This confuses me.  The paragraph above the code seems to say that altering
$_[-1] does *not* modify the variable passed to signal_connect()

That's so.  Something like

    my $something = 1;
    $obj->signal_connect (sig => &my_func, $something);
    sub my_func {
      $_[-1] = 2;

Leaves the original $something unchanged.  signal_connect() copies with
newSVsv then passes that new sv to the callbacks.  I'll try to reword it
a bit.  Perhaps there's somewhere good in the main perl docs that could
be cross referenced on that sort of copy/shallow-copy/whatnot.

-- but the
point of this thread has been to guarantee that it does, right?

Well, the net point is supposed to be a refcount fix, but detouring
unintendedly via an extra sv copy. :)

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