From 151f133e54c5b2e4f9ae75659bff9c44d48f25f0 Mon Sep 17 00:00:00 2001 From: Viacheslav Kulish <32914239+vcoolish@users.noreply.github.com> Date: Tue, 24 Sep 2024 20:45:22 +0400 Subject: [PATCH] Fix JVM native name --- codegen/lib/templates/kotlin/android_class.erb | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/codegen/lib/templates/kotlin/android_class.erb b/codegen/lib/templates/kotlin/android_class.erb index 7ab4876a4c0..6c1fa4ad5ee 100644 --- a/codegen/lib/templates/kotlin/android_class.erb +++ b/codegen/lib/templates/kotlin/android_class.erb @@ -58,8 +58,8 @@ actual class <%= entity.name %> private constructor( <% unless entity.methods.select{ |x| x.name == "Delete" }.empty? -%> @JvmStatic - @JvmName("nativeDelete") - external fun nativeDelete(handle: Long) + @JvmName("delete") + private external fun delete(handle: Long) <%- end -%> <%- constructors.each do |constructor| -%> @@ -88,7 +88,7 @@ actual class <%= entity.name %> private constructor( Thread.currentThread().interrupt() } }.run { - name = "WCFinalizingDaemon" + name = "<%= entity.name %>FinalizingDaemon" isDaemon = true priority = Thread.NORM_PRIORITY start() @@ -100,11 +100,10 @@ actual class <%= entity.name %> private constructor( } private fun doDeletes() { - var ref = queue.poll() as? <%= entity.name %>PhantomReference - while (ref != null) { - nativeDelete(ref.nativeHandle) + while (true) { + val ref = queue.remove() as <%= entity.name %>PhantomReference + delete(ref.nativeHandle) references.remove(ref) - ref = queue.poll() as <%= entity.name %>PhantomReference } } }