]> git.eshelyaron.com Git - emacs.git/commitdiff
Properly deinitialize directory cursors on closedir
authorPo Lu <luangruo@yahoo.com>
Sun, 12 May 2024 12:24:19 +0000 (20:24 +0800)
committerEshel Yaron <me@eshelyaron.com>
Sun, 12 May 2024 15:49:40 +0000 (17:49 +0200)
* 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)

src/androidvfs.c

index 004abd625186512eb0bbf90d63964a6dc98ed753..c0bd86e54b8d1207ae34f1f9db6fb866eb58d857 100644 (file)
@@ -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