NativeScript / NativeScript/nativescript-cli

NS 7 thread worker native object reference null

未关闭
#5,421 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

主要语言
JavaScript
星标
1.1k
派生
204
平均合并
1 天 9 小时
30 天内合并 PR
8

描述

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

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

未指定源文件或测试。首先使用 NativeScript 7 中的自定义 Java ObjectPool 重现 worker 终止和重新创建的过程,然后与 NativeScript 6 进行比较;当重新创建的 worker 能够解析原生对象引用并调用 ObjectPool.getInstance,且不出现报告的 TypeError 时,即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
android, javascript
领域
mobile-dev
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
需要澄清
新手友好度
25/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。