mirror of
https://github.com/salvadordf/CEF4Delphi.git
synced 2024-11-24 08:02:15 +02:00
Fixed TCefMainArgs declaration for MacOS and Linux
Fixed TCEFArgCopy for the updated TCefMainArgs declaration. Use TCEFArgCopy for Linux targets in all IDEs
This commit is contained in:
parent
0062f1f580
commit
1700eedac7
@ -293,7 +293,7 @@ type
|
||||
{$IFDEF LINUX}
|
||||
function GetXDisplay : PXDisplay;
|
||||
function GetArgc : longint;
|
||||
function GetArgv : PPChar;
|
||||
function GetArgv : PPAnsiChar;
|
||||
{$ENDIF}
|
||||
|
||||
function LoadCEFlibrary : boolean; virtual;
|
||||
@ -516,7 +516,7 @@ type
|
||||
property EnableHighDPISupport : boolean read FEnableHighDPISupport write FEnableHighDPISupport;
|
||||
{$IFDEF LINUX}
|
||||
property argcCopy : longint read GetArgc;
|
||||
property argvCopy : PPChar read GetArgv;
|
||||
property argvCopy : PPAnsiChar read GetArgv;
|
||||
{$ENDIF}
|
||||
|
||||
// Custom properties
|
||||
@ -1354,19 +1354,19 @@ begin
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF LINUX}
|
||||
{$IFDEF FPC}
|
||||
// Create a copy of argv on Linux because Chromium mangles the value internally (see CEF issue #620).
|
||||
// https://bitbucket.org/chromiumembedded/cef/issues/620/cef3-linux-crash-when-passing-command-line
|
||||
if (FArgCopy.argv = nil) then
|
||||
FArgCopy.CopyFromArgs(argc, argv);
|
||||
begin
|
||||
{$IFDEF FPC}
|
||||
FArgCopy.CopyFromArgs(argc, argv);
|
||||
{$ELSE}
|
||||
FArgCopy.CopyFromArgs(ArgCount, ArgValues);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
aCefMainArgs.argc := FArgCopy.argc;
|
||||
aCefMainArgs.argv := FArgCopy.argv;
|
||||
{$ELSE}
|
||||
// TO-DO: FMX should also copy argv to FArgCopy like FPC
|
||||
aCefMainArgs.argc := ArgCount;
|
||||
aCefMainArgs.argv := PPWideChar(ArgValues);
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
|
||||
{$IFDEF MACOSX}
|
||||
@ -1375,7 +1375,7 @@ begin
|
||||
aCefMainArgs.argv := argv;
|
||||
{$ELSE}
|
||||
aCefMainArgs.argc := ArgCount;
|
||||
aCefMainArgs.argv := PPWideChar(ArgValues);
|
||||
aCefMainArgs.argv := ArgValues;
|
||||
{$ENDIF}
|
||||
{$ENDIF}
|
||||
end;
|
||||
@ -2457,7 +2457,7 @@ begin
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
function TCefApplicationCore.GetArgv : PPChar;
|
||||
function TCefApplicationCore.GetArgv : PPAnsiChar;
|
||||
begin
|
||||
if (FArgCopy <> nil) then
|
||||
Result := FArgCopy.argv
|
||||
|
@ -51,7 +51,7 @@ interface
|
||||
|
||||
uses
|
||||
{$IFDEF DELPHI16_UP}
|
||||
System.Classes, System.SysUtils;
|
||||
System.Classes, System.SysUtils, System.AnsiStrings;
|
||||
{$ELSE}
|
||||
Classes, SysUtils;
|
||||
{$ENDIF}
|
||||
@ -60,7 +60,7 @@ type
|
||||
TCEFArgCopy = class
|
||||
protected
|
||||
FArgCCopy : longint;
|
||||
FArgVCopy : PPChar;
|
||||
FArgVCopy : PPAnsiChar;
|
||||
|
||||
procedure InitializeFields;
|
||||
procedure DestroyFields;
|
||||
@ -68,10 +68,10 @@ type
|
||||
public
|
||||
constructor Create;
|
||||
destructor Destroy; override;
|
||||
procedure CopyFromArgs(aArgc : longint; aArgv : PPChar);
|
||||
procedure CopyFromArgs(aArgc : longint; aArgv : PPAnsiChar);
|
||||
|
||||
property argc : longint read FArgCCopy;
|
||||
property argv : PPChar read FArgVCopy;
|
||||
property argc : longint read FArgCCopy;
|
||||
property argv : PPAnsiChar read FArgVCopy;
|
||||
end;
|
||||
|
||||
implementation
|
||||
@ -109,7 +109,7 @@ begin
|
||||
while (i >= 0) do
|
||||
begin
|
||||
if (FArgVCopy[i] <> nil) then
|
||||
StrDispose(FArgVCopy[i]);
|
||||
{$IFNDEF FPC}System.AnsiStrings.{$ENDIF}StrDispose(FArgVCopy[i]);
|
||||
|
||||
dec(i);
|
||||
end;
|
||||
@ -120,7 +120,7 @@ begin
|
||||
InitializeFields;
|
||||
end;
|
||||
|
||||
procedure TCEFArgCopy.CopyFromArgs(aArgc : longint; aArgv : PPChar);
|
||||
procedure TCEFArgCopy.CopyFromArgs(aArgc : longint; aArgv : PPAnsiChar);
|
||||
var
|
||||
i : integer;
|
||||
begin
|
||||
@ -135,8 +135,13 @@ begin
|
||||
|
||||
while (i < aArgc) do
|
||||
begin
|
||||
{$IFDEF FPC}
|
||||
FArgVCopy[i] := StrAlloc(length(aArgv[i]) + 1);
|
||||
StrCopy(FArgVCopy[i], aArgv[i]);
|
||||
{$ELSE}
|
||||
FArgVCopy[i] := AnsiStrAlloc(length(aArgv[i]) + 1);
|
||||
System.AnsiStrings.StrCopy(FArgVCopy[i], aArgv[i]);
|
||||
{$ENDIF}
|
||||
|
||||
inc(i);
|
||||
end;
|
||||
|
@ -504,7 +504,7 @@ type
|
||||
instance : HINST;
|
||||
{$ELSE}
|
||||
argc : Integer;
|
||||
argv : PPChar;
|
||||
argv : PPAnsiChar;
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
|
@ -2,7 +2,7 @@
|
||||
"UpdateLazPackages" : [
|
||||
{
|
||||
"ForceNotify" : true,
|
||||
"InternalVersion" : 372,
|
||||
"InternalVersion" : 373,
|
||||
"Name" : "cef4delphi_lazarus.lpk",
|
||||
"Version" : "99.2.13.0"
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user