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

Function call wrongly returns NIL when ownership stays with the foreign part of the code #81

Closed
igorcalabria opened this issue Jan 20, 2021 · 1 comment · Fixed by #82

Comments

@igorcalabria
Copy link

If free-from-foreign is false, mem-get will return NIL when it should return the actual object: https://github.com/andy128k/cl-gobject-introspection/blob/master/src/function.lisp#L312

Here's my fix

          (if-let ((obj (build-object-ptr gir-class ptr)))
            (if free-from-foreign
                (object-setup-gc obj :everything)
                obj))))))

I think this was just a small mistake with the position of obj, since it was on the ELSE-FORM of the if-let macro. If this was a plain "let", the previous version would be just fine since obj would be returned either way.

@andy128k
Copy link
Owner

Thanks a lot!

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

Successfully merging a pull request may close this issue.

2 participants