Skip to content

Commit

Permalink
Merge tag '5.12.1' into master-loongarch64-port
Browse files Browse the repository at this point in the history
  • Loading branch information
theaoqi committed Aug 30, 2022
2 parents db9b504 + 3705b84 commit 211425a
Show file tree
Hide file tree
Showing 24 changed files with 23 additions and 10 deletions.
7 changes: 7 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ NOTE: as of JNA 4.0, JNA is now dual-licensed under LGPL and AL 2.0 (see LICENSE

NOTE: JNI native support is typically incompatible between minor versions, and almost always incompatible between major versions.

Release 5.12.1
==============

Bug Fixes
---------
* [#1447](https://github.com/java-native-access/jna/issues/1447): Null-check cleanable in `c.s.j.Memory#close` - [@dbwiddis](https://github.com/dbwiddis).

Release 5.12.0
==============

Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Java Native Access (JNA)
========================

The definitive JNA reference (including an overview and usage details) is in the [JavaDoc](http://java-native-access.github.io/jna/5.12.0/javadoc/). Please read the [overview](http://java-native-access.github.io/jna/5.12.0/javadoc/overview-summary.html#overview_description). Questions, comments, or exploratory conversations should begin on the [mailing list](http://groups.google.com/group/jna-users), although you may find it easier to find answers to already-solved problems on [StackOverflow](http://stackoverflow.com/questions/tagged/jna).
The definitive JNA reference (including an overview and usage details) is in the [JavaDoc](http://java-native-access.github.io/jna/5.12.1/javadoc/). Please read the [overview](http://java-native-access.github.io/jna/5.12.1/javadoc/overview-summary.html#overview_description). Questions, comments, or exploratory conversations should begin on the [mailing list](http://groups.google.com/group/jna-users), although you may find it easier to find answers to already-solved problems on [StackOverflow](http://stackoverflow.com/questions/tagged/jna).

JNA provides Java programs easy access to native shared libraries without writing anything but Java code - no JNI or native code is required. This functionality is comparable to Windows' Platform/Invoke and Python's ctypes.

Expand Down Expand Up @@ -65,20 +65,20 @@ Pre-built platform support may be found [here](https://github.com/java-native-ac
Download
========

Version 5.12.0
Version 5.12.1

JNA
---

[![Maven Central](https://img.shields.io/maven-central/v/net.java.dev.jna/jna.svg?label=Maven%20Central)](https://search.maven.org/artifact/net.java.dev.jna/jna/5.12.0/jar) [jna-5.12.0.jar](https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.12.0/jna-5.12.0.jar) [jna-jpms-5.12.0.jar](https://repo1.maven.org/maven2/net/java/dev/jna/jna-jpms/5.12.0/jna-jpms-5.12.0.jar)
[![Maven Central](https://img.shields.io/maven-central/v/net.java.dev.jna/jna.svg?label=Maven%20Central)](https://search.maven.org/artifact/net.java.dev.jna/jna/5.12.1/jar) [jna-5.12.1.jar](https://repo1.maven.org/maven2/net/java/dev/jna/jna/5.12.1/jna-5.12.1.jar) [jna-jpms-5.12.1.jar](https://repo1.maven.org/maven2/net/java/dev/jna/jna-jpms/5.12.1/jna-jpms-5.12.1.jar)

This is the core artifact of JNA and contains only the binding library and the
core helper classes.

JNA Platform
------------

[![Maven Central](https://img.shields.io/maven-central/v/net.java.dev.jna/jna-platform.svg?label=Maven%20Central)](https://search.maven.org/artifact/net.java.dev.jna/jna-platform/5.12.0/jar) [jna-platform-5.12.0.jar](https://repo1.maven.org/maven2/net/java/dev/jna/jna-platform/5.12.0/jna-platform-5.12.0.jar) [jna-platform-jpms-5.12.0.jar](https://repo1.maven.org/maven2/net/java/dev/jna/jna-platform-jpms/5.12.0/jna-platform-jpms-5.12.0.jar)
[![Maven Central](https://img.shields.io/maven-central/v/net.java.dev.jna/jna-platform.svg?label=Maven%20Central)](https://search.maven.org/artifact/net.java.dev.jna/jna-platform/5.12.1/jar) [jna-platform-5.12.1.jar](https://repo1.maven.org/maven2/net/java/dev/jna/jna-platform/5.12.1/jna-platform-5.12.1.jar) [jna-platform-jpms-5.12.1.jar](https://repo1.maven.org/maven2/net/java/dev/jna/jna-platform-jpms/5.12.1/jna-platform-jpms-5.12.1.jar)

This artifact holds cross-platform mappings and mappings for a number of commonly used platform
functions, including a large number of Win32 mappings as well as a set of utility classes
Expand Down Expand Up @@ -146,12 +146,12 @@ Using the Library
* [Platform Library](https://github.com/java-native-access/jna/blob/master/www/PlatformLibrary.md)
* [Direct Method Mapping](https://github.com/java-native-access/jna/blob/master/www/DirectMapping.md) (Optimization)
* [Frequently Asked Questions (FAQ)](https://github.com/java-native-access/jna/blob/master/www/FrequentlyAskedQuestions.md)
* [Avoiding Crashes](http://java-native-access.github.io/jna/5.12.0/javadoc/overview-summary.html#crash-protection)
* [Avoiding Crashes](http://java-native-access.github.io/jna/5.12.1/javadoc/overview-summary.html#crash-protection)

Primary Documentation (JavaDoc)
===============================

The definitive JNA reference is in the [JavaDoc](http://java-native-access.github.io/jna/5.12.0/javadoc/).
The definitive JNA reference is in the [JavaDoc](http://java-native-access.github.io/jna/5.12.1/javadoc/).

Developers
==========
Expand Down
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
<!-- JNA library release version - android versionCode is derived from mjar/minor/revision -->
<property name="jna.major" value="5"/>
<property name="jna.minor" value="12"/>
<property name="jna.revision" value="0"/>
<property name="jna.revision" value="1"/>
<property name="jna.build" value="0"/> <!--${build.number}-->
<condition property="version.suffix" value="" else="-SNAPSHOT">
<or>
Expand Down
Binary file modified dist/doc.zip
Binary file not shown.
Binary file modified dist/jna-jpms.jar
Binary file not shown.
Binary file modified dist/jna-min.jar
Binary file not shown.
Binary file modified dist/jna-platform-jpms.jar
Binary file not shown.
Binary file modified dist/jna-platform.jar
Binary file not shown.
Binary file modified dist/jna.aar
Binary file not shown.
Binary file modified dist/jna.jar
Binary file not shown.
Binary file modified dist/jnacontrib/demo-alphamask.jar
Binary file not shown.
Binary file modified dist/jnacontrib/demo-balloonmanager.jar
Binary file not shown.
Binary file modified dist/jnacontrib/demo-balloontips.jar
Binary file not shown.
Binary file modified dist/jnacontrib/demo-dnd.jar
Binary file not shown.
Binary file modified dist/jnacontrib/demo-monitordemo.jar
Binary file not shown.
Binary file modified dist/jnacontrib/demo-msoffice.jar
Binary file not shown.
Binary file modified dist/jnacontrib/demo-nativewindowmsg.jar
Binary file not shown.
Binary file modified dist/jnacontrib/demo-shapedwindow.jar
Binary file not shown.
Binary file modified dist/jnacontrib/demo-w32printing.jar
Binary file not shown.
Binary file modified dist/jnacontrib/demo-w32windowhooks.jar
Binary file not shown.
Binary file modified dist/jnacontrib/demo-x11.jar
Binary file not shown.
Binary file modified dist/src-full.zip
Binary file not shown.
Binary file modified dist/src.zip
Binary file not shown.
12 changes: 9 additions & 3 deletions src/com/sun/jna/Memory.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
*/
package com.sun.jna;

import com.sun.jna.internal.Cleaner;
import java.io.Closeable;
import java.lang.ref.Reference;
import java.lang.ref.WeakReference;
Expand All @@ -32,6 +31,8 @@
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import com.sun.jna.internal.Cleaner;

/**
* A <code>Pointer</code> to memory obtained from the native heap via a
* call to <code>malloc</code>.
Expand Down Expand Up @@ -76,7 +77,7 @@ public static void disposeAll() {
}
}

private Cleaner.Cleanable cleanable;
private final Cleaner.Cleanable cleanable;
protected long size; // Size of the malloc'ed space

/** Provide a view into the original memory. Keeps an implicit reference
Expand Down Expand Up @@ -123,6 +124,7 @@ public Memory(long size) {

protected Memory() {
super();
cleanable = null;
}

/** Provide a view of this memory using the given offset as the base address. The
Expand Down Expand Up @@ -180,9 +182,12 @@ public Memory align(int byteBoundary) {
}

/** Free the native memory and set peer to zero */
@Override
public void close() {
peer = 0;
cleanable.clean();
if (cleanable != null) {
cleanable.clean();
}
}

@Deprecated
Expand Down Expand Up @@ -783,6 +788,7 @@ public MemoryDisposer(long peer) {
this.peer = peer;
}

@Override
public synchronized void run() {
try {
free(peer);
Expand Down

0 comments on commit 211425a

Please sign in to comment.