mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-20 07:19:27 +02:00
* pas2jni: Fixed invoking of Java event handlers from non-main threads.
git-svn-id: trunk@34309 -
This commit is contained in:
parent
57c1338aa1
commit
3b8db21c2c
@ -1265,6 +1265,7 @@ begin
|
||||
Fps.WriteLn('var');
|
||||
Fps.IncI;
|
||||
Fps.WriteLn('_env: PJNIEnv;');
|
||||
Fps.WriteLn('_new_env: boolean;');
|
||||
Fps.WriteLn('_mpi: _TMethodPtrInfo;');
|
||||
if d.Count > 0 then begin
|
||||
Fps.WriteLn(Format('_args: array[0..%d] of jvalue;', [d.Count - 1]));
|
||||
@ -1281,6 +1282,8 @@ begin
|
||||
Fps.WriteLn('begin');
|
||||
Fps.IncI;
|
||||
Fps.WriteLn('CurJavaVM^^.GetEnv(CurJavaVM, @_env, JNI_VERSION_1_6);');
|
||||
Fps.WriteLn('_new_env:=_env = nil;');
|
||||
Fps.WriteLn('if _new_env then CurJavaVM^^.AttachCurrentThread(CurJavaVM, @_env, nil);');
|
||||
Fps.WriteLn('_env^^.PushLocalFrame(_env, 100);');
|
||||
Fps.WriteLn('try');
|
||||
Fps.IncI;
|
||||
@ -1347,6 +1350,7 @@ begin
|
||||
Fps.DecI;
|
||||
Fps.WriteLn('finally');
|
||||
Fps.WriteLn('_env^^.PopLocalFrame(_env, nil);', 1);
|
||||
Fps.WriteLn('if _new_env then CurJavaVM^^.DetachCurrentThread(CurJavaVM);', 1);
|
||||
Fps.WriteLn('end;');
|
||||
Fps.DecI;
|
||||
Fps.WriteLn('end;');
|
||||
|
Loading…
Reference in New Issue
Block a user