8000 Ensure propagation of handle invalidation of native library on manual… · java-native-access/jna@7775be3 · GitHub
[go: up one dir, main page]

Skip to content

Commit 7775be3

Browse files
Ensure propagation of handle invalidation of native library on manual unload
Reported by: @sebbASF Closes: #1561
1 parent 458adcf commit 7775be3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/com/sun/jna/NativeLibrary.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,8 @@ public long getSymbolAddress(long handle, String name, SymbolProvider parent) {
9595
}
9696
};
9797

98-
private Cleaner.Cleanable cleanable;
99-
private long handle;
98+
private final Cleaner.Cleanable cleanable;
99+
private volatile long handle;
100100
private final String libraryName;
101101
private final String libraryPath;
102102
private final Map<String, Function> functions = new HashMap<>();
@@ -701,8 +701,8 @@ public void close() {
701701

702702
synchronized(this) {
703703
if (handle != 0) {
704-
cleanable.clean();
705704
handle = 0;
705+
cleanable.clean();
706706
}
707707
}
708708
}

0 commit comments

Comments
 (0)
0