Skip to content

Commit

Permalink
Workaround for issue #416
Browse files Browse the repository at this point in the history
Possible fix for issue #416 : JSRTTIExtension and CustomTitleBar demos crash in CEF 101
  • Loading branch information
salvadordf committed May 15, 2022
1 parent 2def5dd commit 959d152
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 12 deletions.
29 changes: 18 additions & 11 deletions source/uCEFv8Handler.pas
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ TCefRTTIExtension = class(TCefv8HandlerOwn)
class function StrToPtr(const str: ustring): Pointer;
class function PtrToStr(p: Pointer): ustring;
{$ENDIF}
function HandleProperties(const name: ustring; const arguments: TCefv8ValueArray; var retval: ICefv8Value): boolean;
function Execute(const name: ustring; const object_: ICefv8Value; const arguments: TCefv8ValueArray; var retval: ICefv8Value; var exception: ustring): Boolean; override;

public
Expand Down Expand Up @@ -805,6 +806,19 @@ class function TCefRTTIExtension.PtrToStr(p: Pointer): ustring;
end;
{$ENDIF}

function TCefRTTIExtension.HandleProperties(const name : ustring;
const arguments : TCefv8ValueArray;
var retval : ICefv8Value): boolean;
begin
Result := True;
if name = '$g' then
SetValue(FValue, retval)
else if name = '$s' then
GetValue(FValue.TypeInfo, arguments[0], FValue)
else
Result := False;
end;

function TCefRTTIExtension.Execute(const name : ustring;
const object_ : ICefv8Value;
const arguments : TCefv8ValueArray;
Expand All @@ -825,9 +839,12 @@ function TCefRTTIExtension.Execute(const name : ustring;
ret: TValue;
begin
Result := True;
if HandleProperties(name, arguments, retval) then
exit;

p := PChar(name);
m := nil;
if object_ <> nil then
if assigned(object_) and object_.IsValid then
begin
ud := object_.GetUserData;
if ud <> nil then
Expand Down Expand Up @@ -970,16 +987,6 @@ function TCefRTTIExtension.Execute(const name : ustring;
Exit(False);
end else
Exit(False);
end else
if p^ = '$' then
begin
inc(p);
case p^ of
'g': SetValue(FValue, retval);
's': GetValue(FValue.TypeInfo, arguments[0], FValue);
else
Exit(False);
end;
end else
Exit(False);
end else
Expand Down
2 changes: 1 addition & 1 deletion update_CEF4Delphi.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"UpdateLazPackages" : [
{
"ForceNotify" : true,
"InternalVersion" : 394,
"InternalVersion" : 395,
"Name" : "cef4delphi_lazarus.lpk",
"Version" : "101.0.18.0"
}
Expand Down

0 comments on commit 959d152

Please sign in to comment.