[Top][All Lists]

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

Re: Module support: No environment in pointer release function

From: Elias Mårtenson
Subject: Re: Module support: No environment in pointer release function
Date: Fri, 10 Feb 2017 13:21:12 +0800

On 9 February 2017 at 01:03, Andreas Politz <address@hidden> wrote:
Elias Mårtenson <address@hidden> writes:

> [...] In it, I have to use the make_user_ptr() function in a few
> places. When creating a user_ptr, the function accepts a pointer to a
> function which will be called when the object is GC'ed.

How do you even know its your pointer and not someone elses ?

Because it was me who created the pointer. In the specific case, when I call the GSSAPI function gss_import_name(), this function returns a pointer to an opaque object which needs to be released using the function gss_release_name().

I package up this pointer using env->make_user_pointer() which accept a function that is responsible for freeing the pointer when it's GC'ed.

The issue is that gss_import_name() can return an error. Of course, I've never actually seen it return an error, and I doubt that it ever will in practice. But I'm struggling with the correct way to handle an error. At the very least, I want to know it happened since that would reveal a bug in my code.

Right now I simply call abort() if there is an error. Excessive, I know, but at least I know when there is a problem and the stack trace gives me all the answers I need.

I'm not sure I should keep the abort() in the final version though.


reply via email to

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