guile-user
[Top][All Lists]
Advanced

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

Re: G-Golf - Callback segmentation fault


From: David Pirotte
Subject: Re: G-Golf - Callback segmentation fault
Date: Wed, 21 Aug 2024 21:21:29 -0300

Hello Matija,

> I'm facing the problem mentioned in [1]. Problematic are all examples
> with virtual methods.

Ok, so you are facing the same problem as Guix and HomeBrew, all other
distro (that tried g-golf) work fine, i use Debian.

> I have tried simpler example (attached) with same result. There is no
> problem, when try same thing with guile-gi library. Somehow, callbacks
> are not callable back from C code. Any clue?

        afaict, guile-gi does not support the definition of virtual
        functions - you can try this example using guile-gi
        (which afaict is unmaintained) because you are calling a
        'regular' method, set-draw-func

        no problem, just saying that a mechanism to define vfunc in
        the GI lang binding of your choice is absolutely crucial for any
        'real serious' gnome stack (type)libs use

        one big diffference in between guile-gi and g-golf is that in
        g-golf, the callback closure marshal code is written in scheme,
        the one in guile-gi is written in C - it could be that the
        pointer of the vfunc 'is fine' in guix/nix as well, but that for
        some reason, the %g-golf-callback-closure-marshal pointer
        would be the one that is damaged, i don't know

Great, never used that function. You incidentally found a small bug in
GI itself [1], and a tiny bug in G-Golf as well, though not the one
that would solve the Guix/Nix/Homebrew problem yet [2], but thanks:

        can you install from the source
        checkout the devel branch
        run the make danse and install the latest

        [ to double check, you need this commit
        [ 134b57f52bc23cea8e3e02b974c7b909bb7cf56e

So, here, after i patched g-golf to deal with this GI destroy notify
callback tiny problem, so i can pass #f as its argument, then it works
fine, as expected:

        https://imgur.com/a/tX8bn16

I slightly patched your example so it allows you to call it passing a
-d [--debug] argument on the command line, which triggers the
display of useful information while debugging ...

> I'm using Nix.

It would be interesting to try to understand the difference in between
Debian (and most other distro) and Guix/Nix: when a vfunc is defined,
it sets the upstream class structure field to a pointer, the result of
calling g-callable-info-make-closure (defined in (g-golf hl-api
callback).

For some reason, that pointer is 'damaged' in Guix/Nix/Homebrew, and
not in Debian (and most other distro), and as the gdb backtrace shows,
in the msg link you are referring to, when Gtk tries to make a snapshot,
it needs to access and 'call that pointer', which segfault ...

I hope you'll be able to help, feel free to come and join us in #guile
or #guix and try to get some help from a guix expert ...

Thanks,
David

[1]

all destroy notify callback argument ('linked' to a user-data argument)
should always allow to be NULL, which g-golf checks by calling (>=
(!destroy clb/arg) 0)  but the signature of the destroy notify callback
argument for gtk_drawing_area_set_draw_func wrongly report -1

[2]

i did report the incident upstream, and meanwhile, patched g-golf so it
treats callback argument named "destroy" as a maybe-null-exception,
which checks itself had a tiny bug, fixed, thanks!

Attachment: nix-set-draw-func.scm
Description: Text Data

Attachment: pgp4UsEN31zRp.pgp
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]