The two programs below get segvs for me. I suspect it's a stack pointer PUTBACK problem in the $obj->get xsub. The contortions of grow_the_stack() provoke an EXTEND(SP,n) deep inside g_object_get() proper, but coming back to the $obj->get xsub the "PPCODE" ends with a PUTBACK of an old and now invalidated SP pointer. You can fiddle with the n grown. A small value like 10 and both programs run ok. The bad point is around 124, which is suspiciously close to the default stack allocation of 127 (if it's still 127 in recent perls). Does that sound likely? If so I guess it's only the usual PUTBACK/SPAGAIN rules of a call_sv(), except buried down through multi layers of funcs into and then back out of gtk. Incidentally, if you're wondering why some like $container->foreach making callbacks seem ok, I think it's because they end XSRETURN, and that macro doesn't PUTBACK the SP, but instead applies an adjustment to the global directly, and hence works with wherever the global might have moved to. I've got no idea if you're supposed to rely on that.
Attachment:
region.pl
Description: Text Data
Attachment:
langs.pl
Description: Text Data
Attachment:
GObject.xs.putback.diff
Description: Text Data