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

Structure.clear() should invoke ensureAllocated() #107

Closed
cowwoc opened this issue Aug 21, 2012 · 0 comments
Closed

Structure.clear() should invoke ensureAllocated() #107

cowwoc opened this issue Aug 21, 2012 · 0 comments

Comments

@cowwoc
Copy link

cowwoc commented Aug 21, 2012

Structure.clear() should invoke ensureAllocated() before accessing "memory". Given:

public class Foo extends Structure
{
  public volatile Pointer one;

  public Foo()
  {
    setFieldOrder(new String[]{"one"});
    clear();
  }
}

What will happen is:

  1. Structure initializes memory to a AutoAllocated buffer
  2. setFieldOrder() sets memory to null
  3. clear() uses memory before ensuring it is allocated, throwing NullPointerException
twall added a commit that referenced this issue Aug 28, 2012
@twall twall closed this as completed Aug 28, 2012
mstyura pushed a commit to mstyura/jna that referenced this issue Sep 9, 2024
Motivation:

We should not see any errors due javadocs

Modification:

Fix javadoc error

Result:

./mvnw javadoc:javadoc dont fail
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