nativescript-cli icon indicating copy to clipboard operation
nativescript-cli copied to clipboard

NS 7 thread worker native object reference null

Open juanchinovas opened this issue 5 years ago • 2 comments

Environment

  • CLI: 7.0.8
  • Android Runtime: 7.0.0

Describe the bug

I'm using a custom Java class to hold native objects references to share between UI thread and an worker thread, that Worker thread with globals module imported can find and execute native code like java.lang.Thread.currentThread().getName() or my Java Class, as expected, but when its terminated and re-created throw an error and the app stops because cannot find the native objects instances to work with.

-- First time exec

JS: =================== W0: ./aeb532eaa4f320c850fc.worker.js ===================
JS: pkg: com.jnovas {
JS:   "objectpool": {}
JS: }
JS: pkg: java.lang.Thread function () { [native code] }

-- Second time exec

JS: =================== worker ===================
JS: pkg: com.jnovas {"ObjectPool":0,"objectpool":{"BuildConfig":0}}
JS: pkg: java.lang.Thread 0
JS: Uncaught TypeError: com.jnovas.ObjectPool.getInstance is not a function

Additional context works just fine on NS 6

juanchinovas avatar Oct 17 '20 18:10 juanchinovas

  1. Which version of NS6 runtime did it last work on?
  2. Can you provide a sample app (we can sign a NDA if need be) to show the issue?

NathanaelA avatar Oct 17 '20 18:10 NathanaelA

  1. Which version of NS6 runtime did it last work on? NS v6.1.2
  2. Can you provide a sample app (we can sign a NDA if need be) to show the issue? demo708.zip

juanchinovas avatar Oct 17 '20 19:10 juanchinovas