mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-29 20:20:16 +02:00
* Make sure reference count is properly managed
This commit is contained in:
parent
919f8f383d
commit
1e6061845e
@ -771,7 +771,7 @@ type
|
|||||||
function _getResizable: Boolean;
|
function _getResizable: Boolean;
|
||||||
public
|
public
|
||||||
constructor create (aSize : integer);
|
constructor create (aSize : integer);
|
||||||
class function GlobalMemory : TJSArrayBuffer;
|
class function GlobalMemory : IJSArrayBuffer;
|
||||||
function Slice : IJSArrayBuffer;
|
function Slice : IJSArrayBuffer;
|
||||||
function Slice (aStart : NativeInt): IJSArrayBuffer;
|
function Slice (aStart : NativeInt): IJSArrayBuffer;
|
||||||
function Slice (aStart,aEndExclusive : NativeInt): IJSArrayBuffer;
|
function Slice (aStart,aEndExclusive : NativeInt): IJSArrayBuffer;
|
||||||
@ -2294,9 +2294,15 @@ begin
|
|||||||
JobCreate(True,[aSize])
|
JobCreate(True,[aSize])
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TJSArrayBuffer.GlobalMemory: TJSArrayBuffer;
|
class function TJSArrayBuffer.GlobalMemory: IJSArrayBuffer;
|
||||||
|
|
||||||
|
var
|
||||||
|
Obj : TJSArrayBuffer;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result:=JOBCreateGlobal('InstanceBuffer');
|
Obj:=TJSArrayBuffer.JOBCreateGlobal('InstanceBuffer');
|
||||||
|
Obj.FJOBObjectIDOwner:=True;
|
||||||
|
Result:=Obj;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TJSArrayBuffer.Slice: IJSArrayBuffer;
|
function TJSArrayBuffer.Slice: IJSArrayBuffer;
|
||||||
@ -2998,7 +3004,6 @@ begin
|
|||||||
inc(p,4);
|
inc(p,4);
|
||||||
Result:=aResultClass.JOBCreateFromID(ObjId);
|
Result:=aResultClass.JOBCreateFromID(ObjId);
|
||||||
Result.JOBObjectIDOwner:=True; // The objects passed are not freed, we need to do it.
|
Result.JOBObjectIDOwner:=True; // The objects passed are not freed, we need to do it.
|
||||||
// Writeln('Will free ',ObjID);
|
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
raise EJSArgParse.Create(JOBArgNames[p^]);
|
raise EJSArgParse.Create(JOBArgNames[p^]);
|
||||||
@ -4368,9 +4373,10 @@ var
|
|||||||
Buf: array[0..7] of byte;
|
Buf: array[0..7] of byte;
|
||||||
p: PByte;
|
p: PByte;
|
||||||
r: TJOBResult;
|
r: TJOBResult;
|
||||||
Obj: TJSObject;
|
Obj: IInterface;
|
||||||
func : TJSFunction;
|
func : TJSFunction;
|
||||||
objid,thisid : TJOBObjectID;
|
objid,thisid : TJOBObjectID;
|
||||||
|
Tmp : TJSObject;
|
||||||
begin
|
begin
|
||||||
FillByte(Buf[0],length(Buf),0);
|
FillByte(Buf[0],length(Buf),0);
|
||||||
p:=@Buf[0];
|
p:=@Buf[0];
|
||||||
@ -4396,8 +4402,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
JOBResult_Object:
|
JOBResult_Object:
|
||||||
begin
|
begin
|
||||||
Obj:=TJSObject.JOBCreateFromID(PJOBObjectID(p)^);
|
Tmp:=TJSObject.JOBCreateFromID(PJOBObjectID(p)^);
|
||||||
Result:=Obj as IJSObject;
|
Obj:=Tmp;
|
||||||
|
Result:=Obj;
|
||||||
|
Obj:=nil;
|
||||||
end;
|
end;
|
||||||
else
|
else
|
||||||
VarClear(Result);
|
VarClear(Result);
|
||||||
|
Loading…
Reference in New Issue
Block a user