Skip to content

Commit df2f00e

Browse files
fix: shut down executor on catalyst instance destroy to prevent thread leak
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent eb50b7c commit df2f00e

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

android/app/src/main/java/ai/offgridmobile/download/DownloadManagerModule.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,13 @@ class DownloadManagerModule(reactContext: ReactApplicationContext) :
122122

123123
override fun getName(): String = NAME
124124

125+
override fun onCatalystInstanceDestroy() {
126+
super.onCatalystInstanceDestroy()
127+
if (!executor.isShutdown) {
128+
executor.shutdown()
129+
}
130+
}
131+
125132
@ReactMethod
126133
fun startDownload(params: ReadableMap, promise: Promise) {
127134
val url = params.getString("url") ?: run {

0 commit comments

Comments
 (0)