expo-modules-core 0.11.7 → 0.11.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,13 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 0.11.8 — 2022-10-13
14
+
15
+ ### 🐛 Bug fixes
16
+
17
+ - Fixed `Updates.reloadAsync` from `expo-updates` occasionally crashes the app. ([#19539](https://github.com/expo/expo/pull/19539) by [@kudo](https://github.com/kudo), [@kudo](https://github.com/kudo))
18
+ - Fixed `JSCRuntime destroyed with a dangling API object` on Android. ([#19487](https://github.com/expo/expo/pull/19487) by [@lukmccall](https://github.com/lukmccall))
19
+
13
20
  ## 0.11.7 — 2022-10-06
14
21
 
15
22
  ### 🐛 Bug fixes
@@ -6,7 +6,7 @@ apply plugin: 'maven-publish'
6
6
  apply plugin: "de.undercouch.download"
7
7
 
8
8
  group = 'host.exp.exponent'
9
- version = '0.11.7'
9
+ version = '0.11.8'
10
10
 
11
11
  buildscript {
12
12
  def expoModulesCorePlugin = new File(project(":expo-modules-core").projectDir.absolutePath, "ExpoModulesCorePlugin.gradle")
@@ -161,7 +161,7 @@ android {
161
161
  targetSdkVersion safeExtGet("targetSdkVersion", 31)
162
162
  consumerProguardFiles 'proguard-rules.pro'
163
163
  versionCode 1
164
- versionName "0.11.7"
164
+ versionName "0.11.8"
165
165
 
166
166
  testInstrumentationRunner "expo.modules.TestRunner"
167
167
 
@@ -12,6 +12,13 @@ namespace expo {
12
12
  ExpoModulesHostObject::ExpoModulesHostObject(JSIInteropModuleRegistry *installer)
13
13
  : installer(installer) {}
14
14
 
15
+ /**
16
+ * Clears jsi references held by JSRegistry and JavaScriptRuntime.
17
+ */
18
+ ExpoModulesHostObject::~ExpoModulesHostObject() {
19
+ installer->runtimeHolder.reset();
20
+ }
21
+
15
22
  jsi::Value ExpoModulesHostObject::get(jsi::Runtime &runtime, const jsi::PropNameID &name) {
16
23
  auto cName = name.utf8(runtime);
17
24
  auto module = installer->getModule(cName);
@@ -20,6 +20,8 @@ class ExpoModulesHostObject : public jsi::HostObject {
20
20
  public:
21
21
  ExpoModulesHostObject(JSIInteropModuleRegistry *installer);
22
22
 
23
+ ~ExpoModulesHostObject() override;
24
+
23
25
  jsi::Value get(jsi::Runtime &, const jsi::PropNameID &name) override;
24
26
 
25
27
  void set(jsi::Runtime &, const jsi::PropNameID &name, const jsi::Value &value) override;
@@ -137,6 +137,18 @@ void JavaScriptModuleObject::registerProperty(
137
137
  JavaScriptModuleObject::HostObject::HostObject(
138
138
  JavaScriptModuleObject *jsModule) : jsModule(jsModule) {}
139
139
 
140
+ /**
141
+ * Clears all the JSI references held by the `JavaScriptModuleObject`.
142
+ */
143
+ JavaScriptModuleObject::HostObject::~HostObject() {
144
+ if (jsModule->jsiObject != nullptr) {
145
+ jsModule->jsiObject.reset();
146
+ }
147
+ jsModule->methodsMetadata.clear();
148
+ jsModule->constants.clear();
149
+ jsModule->properties.clear();
150
+ }
151
+
140
152
  jsi::Value JavaScriptModuleObject::HostObject::get(jsi::Runtime &runtime,
141
153
  const jsi::PropNameID &name) {
142
154
  auto cName = name.utf8(runtime);
@@ -103,6 +103,8 @@ public:
103
103
  public:
104
104
  HostObject(JavaScriptModuleObject *);
105
105
 
106
+ ~HostObject() override;
107
+
106
108
  jsi::Value get(jsi::Runtime &, const jsi::PropNameID &name) override;
107
109
 
108
110
  void set(jsi::Runtime &, const jsi::PropNameID &name, const jsi::Value &value) override;
@@ -111,8 +111,9 @@ public class ModuleRegistryAdapter implements ReactPackage {
111
111
  ReactApplicationContext reactContext,
112
112
  @Nullable ModuleRegistry moduleRegistry
113
113
  ) {
114
- if (mModulesProxy != null && mModulesProxy.getKotlinInteropModuleRegistry().getWasDestroyed()) {
114
+ if (mModulesProxy != null && mModulesProxy.getReactContext() != reactContext) {
115
115
  mModulesProxy = null;
116
+ mWrapperDelegateHolders = null;
116
117
  }
117
118
  if (mModulesProxy == null) {
118
119
  ModuleRegistry registry = moduleRegistry != null ? moduleRegistry : mModuleRegistryProvider.get(reactContext);
@@ -255,4 +255,8 @@ public class NativeModulesProxy extends ReactContextBaseJavaModule {
255
255
  ModuleRegistry getModuleRegistry() {
256
256
  return mModuleRegistry;
257
257
  }
258
+
259
+ /* package */ ReactApplicationContext getReactContext() {
260
+ return getReactApplicationContext();
261
+ }
258
262
  }
@@ -25,9 +25,6 @@ class KotlinInteropModuleRegistry(
25
25
  private val registry: ModuleRegistry
26
26
  get() = appContext.registry
27
27
 
28
- var wasDestroyed = false
29
- private set
30
-
31
28
  fun hasModule(name: String): Boolean = registry.hasModule(name)
32
29
 
33
30
  fun callMethod(moduleName: String, method: String, arguments: ReadableArray, promise: Promise) {
@@ -111,7 +108,6 @@ class KotlinInteropModuleRegistry(
111
108
 
112
109
  fun onDestroy() {
113
110
  appContext.onDestroy()
114
- wasDestroyed = true
115
111
  }
116
112
 
117
113
  fun installJSIInterop() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-modules-core",
3
- "version": "0.11.7",
3
+ "version": "0.11.8",
4
4
  "description": "The core of Expo Modules architecture",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -42,5 +42,5 @@
42
42
  "@testing-library/react-hooks": "^7.0.1",
43
43
  "expo-module-scripts": "^2.0.0"
44
44
  },
45
- "gitHead": "d94331a2fd0db76d4a8438ae7216b43082999bf1"
45
+ "gitHead": "da2b9d2bb73100781b31906967669fe521d55e8a"
46
46
  }