Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wrong uses of with-foreign-object #87

Open
aymeric-nb opened this issue Jan 17, 2021 · 1 comment
Open

wrong uses of with-foreign-object #87

aymeric-nb opened this issue Jan 17, 2021 · 1 comment

Comments

@aymeric-nb
Copy link

Hi,

cairo-font-extents in cairo/cairo.text.lisp returns a (:struct cairo-font-extents-t) obtained from with-foreign-object.

However, according to with-foreign-object's documentation, the object created by it is not valid outside the scope of with-foreign-object, if I understand correctly.

Indeed, accessing a field of the returned structure leads to a crash at least under ECL on NetBSD/amd64.

Sorry for not providing any patch, but I don't see a way around this bug without changing the lisp API.
A workaround is to use directly cairo::%cairo-font-extents but as the name implies, this is suboptimal.

A quick look around shows there are other such uses in other functions, so if you confirm my analysis, I think you should audit all uses of with-foreign-object and similar macros.

Regards

@stacksmith
Copy link

There are many terrible things hidden here, due to the author's misunderstanding of GTK objects and their lifespan. Beware.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants