@bits-innovate/react-native-vstarcam 1.0.50 → 1.0.52
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.
|
@@ -60,6 +60,9 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
|
|
|
60
60
|
private static Object commandListenerProxy;
|
|
61
61
|
private static Object releaseListenerProxy;
|
|
62
62
|
|
|
63
|
+
// Hard reference root to completely prevent Dalvik GC of our JNI proxies
|
|
64
|
+
private static final java.util.ArrayList<Object> jniProxyRoots = new java.util.ArrayList<>();
|
|
65
|
+
|
|
63
66
|
// Static context reference for reloads
|
|
64
67
|
private static java.lang.ref.WeakReference<ReactApplicationContext> currentContext;
|
|
65
68
|
|
|
@@ -236,6 +239,11 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
|
|
|
236
239
|
Log.e(TAG, "Cannot initialize P2P: native library or JNIApi not available");
|
|
237
240
|
return;
|
|
238
241
|
}
|
|
242
|
+
|
|
243
|
+
if (VStarCamModule.isP2PInitialized) {
|
|
244
|
+
Log.d(TAG, "P2P system already initialized. Skipping JNIApi.init() to prevent C++ SDK crashes during hot reload.");
|
|
245
|
+
return;
|
|
246
|
+
}
|
|
239
247
|
|
|
240
248
|
try {
|
|
241
249
|
// Create dynamic proxy for ClientStateListener
|
|
@@ -278,6 +286,7 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
|
|
|
278
286
|
}
|
|
279
287
|
}
|
|
280
288
|
);
|
|
289
|
+
jniProxyRoots.add(stateListenerProxy);
|
|
281
290
|
|
|
282
291
|
// Create dynamic proxy for ClientCommandListener
|
|
283
292
|
commandListenerProxy = Proxy.newProxyInstance(
|
|
@@ -321,6 +330,7 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
|
|
|
321
330
|
}
|
|
322
331
|
}
|
|
323
332
|
);
|
|
333
|
+
jniProxyRoots.add(commandListenerProxy);
|
|
324
334
|
|
|
325
335
|
// Create dynamic proxy for ClientReleaseListener
|
|
326
336
|
releaseListenerProxy = Proxy.newProxyInstance(
|
|
@@ -347,6 +357,7 @@ public class VStarCamModule extends ReactContextBaseJavaModule {
|
|
|
347
357
|
}
|
|
348
358
|
}
|
|
349
359
|
);
|
|
360
|
+
jniProxyRoots.add(releaseListenerProxy);
|
|
350
361
|
|
|
351
362
|
// Call JNIApi.init(stateListener, commandListener, releaseListener)
|
|
352
363
|
Method initMethod = VStarCamModule.jniApiClass.getMethod("init",
|