Skip to content

Commit db653cd

Browse files
committed
set pointers to NULL, and then really kill tox and toxav after that
1 parent 79032cc commit db653cd

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

jni-c-toxcore/jni-c-toxcore.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3515,14 +3515,19 @@ void Java_com_zoffcc_applications_trifa_MainActivity_tox_1kill__real(JNIEnv *env
35153515
tox_av_ngc_vcoders_global = NULL;
35163516
toxav_ngc_audio_kill(tox_av_ngc_acoders_global);
35173517
tox_av_ngc_acoders_global = NULL;
3518-
toxav_kill(tox_av_global);
3518+
3519+
// HINT: set pointers to NULL, and then really kill tox and toxav after that
3520+
Tox *tox_global_copy = tox_global;
3521+
ToxAV *tox_av_global_copy = tox_av_global;
35193522
tox_av_global = NULL;
3523+
tox_global = NULL;
3524+
3525+
toxav_kill(tox_av_global_copy);
35203526
#ifdef TOX_HAVE_TOXUTIL
3521-
tox_utils_kill(tox_global);
3527+
tox_utils_kill(tox_global_copy);
35223528
#else
3523-
tox_kill(tox_global);
3529+
tox_kill(tox_global_copy);
35243530
#endif
3525-
tox_global = NULL;
35263531

35273532
pthread_mutex_destroy(&group_audio___mutex);
35283533

0 commit comments

Comments
 (0)