From 15c424c893d076a9662d2d1b979d545f32ab83e0 Mon Sep 17 00:00:00 2001 From: gxz Date: Mon, 11 Mar 2024 19:27:53 +0800 Subject: [PATCH 1/3] fix: fix crash issue when call engine.release without call unregisterEventhandler first --- android/build.gradle | 2 +- example/ios/Podfile.lock | 10 +++++----- react-native-agora.podspec | 2 +- src/internal/RtcEngineExInternal.ts | 1 + 4 files changed, 8 insertions(+), 7 deletions(-) diff --git a/android/build.gradle b/android/build.gradle index 560abc6c..a96dd74f 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -166,7 +166,7 @@ dependencies { implementation fileTree(include: ['*.jar', '*.aar'], dir: 'libs') api 'io.agora.rtc:full-sdk:4.3.0' implementation 'io.agora.rtc:full-screen-sharing:4.3.0' - implementation 'io.agora.rtc:iris-rtc:4.3.0-build.2' + implementation 'io.agora.rtc:iris-rtc:4.3.0-build.5' } if (isNewArchitectureEnabled()) { diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index b29a3e96..7245c9c7 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -1,5 +1,5 @@ PODS: - - AgoraIrisRTC_iOS (4.3.0-build.2) + - AgoraIrisRTC_iOS (4.3.0-build.5) - AgoraRtcEngine_iOS (4.3.0): - AgoraRtcEngine_iOS/AIAEC (= 4.3.0) - AgoraRtcEngine_iOS/AINS (= 4.3.0) @@ -407,8 +407,8 @@ PODS: - React-jsinspector (0.72.10) - React-logger (0.72.10): - glog - - react-native-agora (4.2.6): - - AgoraIrisRTC_iOS (= 4.3.0-build.2) + - react-native-agora (4.3.0): + - AgoraIrisRTC_iOS (= 4.3.0-build.5) - AgoraRtcEngine_iOS (= 4.3.0) - RCT-Folly (= 2021.07.22.00) - React-Core @@ -747,7 +747,7 @@ EXTERNAL SOURCES: :path: "../node_modules/react-native/ReactCommon/yoga" SPEC CHECKSUMS: - AgoraIrisRTC_iOS: 2caf892fa827777fe43b6ac7d12e9b42579eb865 + AgoraIrisRTC_iOS: 499d6035bbf912a458bfdef161e9404a3b62cc3c AgoraRtcEngine_iOS: 267c0980c1fb97e056d05b850f8629b05b6e467a boost: 7dcd2de282d72e344012f7d6564d024930a6a440 CocoaAsyncSocket: 065fd1e645c7abab64f7a6a2007a48038fdc6a99 @@ -782,7 +782,7 @@ SPEC CHECKSUMS: React-jsiexecutor: 45ef2ec6dcde31b90469175ec76ddac77b91dfc3 React-jsinspector: de0198127395fec3058140a20c045167f761bb16 React-logger: dc3a2b174d79c2da635059212747d8d929b54e06 - react-native-agora: d485857dafe397d26f2ba2355b4b7db98508bc17 + react-native-agora: d876ed4bdf5a4813989acc23c0974d4380a51e8b react-native-agora-rawdata: 097895cdccd8fcf3cff5dffe23372f5d3c89fd31 react-native-image-tools: 88218449791389bbf550a2c475a3b564c8233c8b react-native-safe-area-context: 7aa8e6d9d0f3100a820efb1a98af68aa747f9284 diff --git a/react-native-agora.podspec b/react-native-agora.podspec index f3609819..b678fbd8 100644 --- a/react-native-agora.podspec +++ b/react-native-agora.podspec @@ -41,7 +41,7 @@ Pod::Spec.new do |s| end s.dependency 'AgoraRtcEngine_iOS', '4.3.0' - s.dependency 'AgoraIrisRTC_iOS', '4.3.0-build.2' + s.dependency 'AgoraIrisRTC_iOS', '4.3.0-build.5' s.libraries = 'stdc++' s.framework = 'ReplayKit' end diff --git a/src/internal/RtcEngineExInternal.ts b/src/internal/RtcEngineExInternal.ts index 004c6494..bf23c110 100644 --- a/src/internal/RtcEngineExInternal.ts +++ b/src/internal/RtcEngineExInternal.ts @@ -91,6 +91,7 @@ export class RtcEngineExInternal extends IRtcEngineExImpl { MediaRecorderInternal._observers.clear(); this._h265_transcoder.release(); this.removeAllListeners(); + super.unregisterEventHandler(this as IRtcEngineEventHandler); super.release(sync); } From 1408a3cd0014d9c98ffbf939e56ddb0a35ff14fa Mon Sep 17 00:00:00 2001 From: gxz Date: Tue, 12 Mar 2024 15:12:10 +0800 Subject: [PATCH 2/3] chore: optimize --- src/internal/RtcEngineExInternal.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/internal/RtcEngineExInternal.ts b/src/internal/RtcEngineExInternal.ts index bf23c110..c571eae3 100644 --- a/src/internal/RtcEngineExInternal.ts +++ b/src/internal/RtcEngineExInternal.ts @@ -91,7 +91,7 @@ export class RtcEngineExInternal extends IRtcEngineExImpl { MediaRecorderInternal._observers.clear(); this._h265_transcoder.release(); this.removeAllListeners(); - super.unregisterEventHandler(this as IRtcEngineEventHandler); + this.unregisterEventHandler(this as IRtcEngineEventHandler); super.release(sync); } From 16e38bf5a26bd609ff21c0edb494a96a8566cb76 Mon Sep 17 00:00:00 2001 From: gxz Date: Tue, 12 Mar 2024 16:33:54 +0800 Subject: [PATCH 3/3] chore: optimize --- src/internal/RtcEngineExInternal.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/internal/RtcEngineExInternal.ts b/src/internal/RtcEngineExInternal.ts index c571eae3..568227e0 100644 --- a/src/internal/RtcEngineExInternal.ts +++ b/src/internal/RtcEngineExInternal.ts @@ -79,6 +79,9 @@ export class RtcEngineExInternal extends IRtcEngineExImpl { override release(sync: boolean = false) { this._media_engine.release(); this._local_spatial_audio_engine.release(); + RtcEngineExInternal._event_handlers.map((it) => { + super.unregisterEventHandler(it); + }); RtcEngineExInternal._event_handlers = []; RtcEngineExInternal._direct_cdn_streaming_event_handler = []; RtcEngineExInternal._metadata_observer = []; @@ -91,7 +94,6 @@ export class RtcEngineExInternal extends IRtcEngineExImpl { MediaRecorderInternal._observers.clear(); this._h265_transcoder.release(); this.removeAllListeners(); - this.unregisterEventHandler(this as IRtcEngineEventHandler); super.release(sync); }