From: Po Lu Date: Sun, 12 May 2024 12:24:19 +0000 (+0800) Subject: Properly deinitialize directory cursors on closedir X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=b229481b4562d97326f16b4c7905c33b78b95b50;p=emacs.git Properly deinitialize directory cursors on closedir * src/androidvfs.c (android_saf_tree_closedir): Call cursor.close, for deleting the local reference to enable its garbage collection is not sufficient to release all related resources. (cherry picked from commit 86d196c71d763ae81229e7e1eb2c6e37d0456f06) --- diff --git a/src/androidvfs.c b/src/androidvfs.c index 004abd62518..c0bd86e54b8 100644 --- a/src/androidvfs.c +++ b/src/androidvfs.c @@ -5562,6 +5562,10 @@ android_saf_tree_closedir (struct android_vdir *vdir) free (dir->name); /* Yes, DIR->cursor is a local reference. */ + (*android_java_env)->CallVoidMethod (android_java_env, + dir->cursor, + cursor_class.close); + (*android_java_env)->ExceptionClear (android_java_env); ANDROID_DELETE_LOCAL_REF (dir->cursor); /* If the ``directory file descriptor'' has been opened, close