From c392c6eb2bc21e60cd411b48dbe6cb8ee82491df Mon Sep 17 00:00:00 2001 From: yury Date: Mon, 30 May 2016 17:14:55 +0000 Subject: [PATCH] * pas2jni: Explicitly release JNI local refs while executing method pointers. git-svn-id: trunk@33859 - --- utils/pas2jni/writer.pas | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/utils/pas2jni/writer.pas b/utils/pas2jni/writer.pas index 4e2bf6b472..c7e4993390 100644 --- a/utils/pas2jni/writer.pas +++ b/utils/pas2jni/writer.pas @@ -1270,6 +1270,9 @@ begin Fps.WriteLn('begin'); Fps.IncI; Fps.WriteLn('CurJavaVM^^.GetEnv(CurJavaVM, @_env, JNI_VERSION_1_6);'); + Fps.WriteLn('_env^^.PushLocalFrame(_env, 100);'); + Fps.WriteLn('try'); + Fps.IncI; Fps.WriteLn('_MethodPointersCS.Enter;'); Fps.WriteLn('try'); Fps.WriteLn('_mpi:=_TMethodPtrInfo(_MethodPointers[-integer(ptruint(Self)) - 1]);', 1); @@ -1330,6 +1333,10 @@ begin end; end; + Fps.DecI; + Fps.WriteLn('finally'); + Fps.WriteLn('_env^^.PopLocalFrame(_env, nil);', 1); + Fps.WriteLn('end;'); Fps.DecI; Fps.WriteLn('end;');