From e44b9364353a6173598eb98d276795d77cc4456c Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Fri, 21 Jun 2019 18:48:37 +0200 Subject: iOS: NativeLibrary: Refine iOS, use proper alt system path for iOS+OSX, relax closeLibrary(..) --- src/java/jogamp/common/os/DynamicLinkerImpl.java | 11 ++++++----- src/java/jogamp/common/os/UnixDynamicLinkerImpl.java | 7 ++++--- 2 files changed, 10 insertions(+), 8 deletions(-) (limited to 'src/java/jogamp') diff --git a/src/java/jogamp/common/os/DynamicLinkerImpl.java b/src/java/jogamp/common/os/DynamicLinkerImpl.java index 56a909e..5ce94c1 100644 --- a/src/java/jogamp/common/os/DynamicLinkerImpl.java +++ b/src/java/jogamp/common/os/DynamicLinkerImpl.java @@ -144,14 +144,15 @@ import com.jogamp.common.util.SecurityUtil; @Override public final void closeLibrary(final long libraryHandle, final boolean debug) throws SecurityException, IllegalArgumentException { final LibRef libRef = decrLibRefCount( libraryHandle ); - if( null == libRef ) { - throw new IllegalArgumentException("Library handle 0x"+Long.toHexString(libraryHandle)+" unknown."); - } - checkLinkPermission(libRef.getName()); + if( null != libRef ) { + checkLinkPermission(libRef.getName()); + } // else null libRef is OK for global lookup if( DEBUG || debug ) { System.err.println("DynamicLinkerImpl.closeLibrary(0x"+Long.toHexString(libraryHandle)+" -> "+libRef+")"); } - closeLibraryImpl(libraryHandle); + if( 0 != libraryHandle ) { + closeLibraryImpl(libraryHandle); + } } protected abstract void closeLibraryImpl(final long libraryHandle) throws SecurityException; diff --git a/src/java/jogamp/common/os/UnixDynamicLinkerImpl.java b/src/java/jogamp/common/os/UnixDynamicLinkerImpl.java index 5e8ba9d..ddaeea2 100644 --- a/src/java/jogamp/common/os/UnixDynamicLinkerImpl.java +++ b/src/java/jogamp/common/os/UnixDynamicLinkerImpl.java @@ -49,15 +49,16 @@ package jogamp.common.os; @Override protected final long lookupSymbolLocalImpl(final long libraryHandle, final String symbolName) throws SecurityException { - return dlsym(libraryHandle, symbolName); + return 0 != libraryHandle ? dlsym(libraryHandle, symbolName) : 0; } @Override protected final void closeLibraryImpl(final long libraryHandle) throws SecurityException { - dlclose(libraryHandle); + if( 0 != libraryHandle ) { + dlclose(libraryHandle); + } } - @Override public final String getLastError() { return dlerror(); -- cgit v1.2.3