Skip to content

Commit

Permalink
Fix engine crash due to Ultralight extraction when running two instan…
Browse files Browse the repository at this point in the history
…ces from the same directory
  • Loading branch information
Twometer committed Oct 10, 2021
1 parent 78bfdbc commit 8ce17ed
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion neko-engine/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
}

group 'de.twometer'
version '2.3.1'
version '2.3.2'

/* Version configuration */
project.ext.lwjglVersion = "3.2.3"
Expand Down
2 changes: 1 addition & 1 deletion neko-engine/src/main/kotlin/de/twometer/neko/Neko.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ package de.twometer.neko

object Neko {

const val VERSION = "2.3.1"
const val VERSION = "2.3.2"

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package de.twometer.neko.gui

import com.labymedia.ultralight.UltralightJava
import com.labymedia.ultralight.UltralightLoadException
import com.labymedia.ultralight.UltralightPlatform
import com.labymedia.ultralight.config.FontHinting
import com.labymedia.ultralight.config.UltralightConfig
Expand All @@ -26,7 +27,14 @@ object UltralightLoader {
if (!Files.exists(ultralightPath))
error("Ultralight natives not found")

UltralightJava.extractNativeLibrary(ultralightPath)
try {
UltralightJava.extractNativeLibrary(ultralightPath)
} catch (e: UltralightLoadException) {
if (e.cause is AccessDeniedException)
logger.warn { "Write access to the Ultralight natives directory is denied. This is probably due to the app already running, ignoring." }
else throw e
}

UltralightJava.load(ultralightPath)

val platform = UltralightPlatform.instance()
Expand Down

0 comments on commit 8ce17ed

Please sign in to comment.