mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 02:39:37 +02:00
LCL-GTK3: Prevent a range error in function ButtonClicked.
git-svn-id: trunk@63844 -
This commit is contained in:
parent
bce7246f36
commit
49a3adfab7
@ -73,19 +73,24 @@ begin
|
|||||||
ModalResult:= {%H-}PtrUInt(g_object_get_data(PGObject(Widget), 'modal_result'));
|
ModalResult:= {%H-}PtrUInt(g_object_get_data(PGObject(Widget), 'modal_result'));
|
||||||
{ Don't allow to close if we don't have a default return value }
|
{ Don't allow to close if we don't have a default return value }
|
||||||
Result:= (ModalResult = 0);
|
Result:= (ModalResult = 0);
|
||||||
if not Result then PInteger(data)^:= ModalResult
|
if Result then
|
||||||
else DebugLn('Do not close !!!');
|
DebugLn('Do not close !!!')
|
||||||
end else Result:= false;
|
else
|
||||||
|
PInteger(data)^:= Integer(ModalResult);
|
||||||
|
end else
|
||||||
|
Result:= false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function ButtonClicked(Widget : PGtkWidget; data: gPointer) : GBoolean; cdecl;
|
function ButtonClicked(Widget : PGtkWidget; data: gPointer) : GBoolean; cdecl;
|
||||||
|
var
|
||||||
|
ModalResult : PtrUInt;
|
||||||
begin
|
begin
|
||||||
PInteger(data)^ := {%H-}PtrUInt(g_object_get_data(PGObject(Widget), 'modal_result'));
|
ModalResult := {%H-}PtrUInt(g_object_get_data(PGObject(Widget), 'modal_result'));
|
||||||
|
PInteger(data)^ := Integer(ModalResult);
|
||||||
Result := False;
|
Result := False;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class function TGtk3DialogFactory.ResponseID(const AnID: Integer): Integer;
|
class function TGtk3DialogFactory.ResponseID(const AnID: Integer): Integer;
|
||||||
begin
|
begin
|
||||||
case AnID of
|
case AnID of
|
||||||
@ -106,7 +111,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
class function TGtk3DialogFactory.gtk_resp_to_lcl(const gtk_resp:integer):integer;
|
class function TGtk3DialogFactory.gtk_resp_to_lcl(const gtk_resp:integer):integer;
|
||||||
begin
|
begin
|
||||||
case gtk_resp of
|
case gtk_resp of
|
||||||
@ -153,7 +157,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TGtk3DialogFactory.CreateButton(
|
procedure TGtk3DialogFactory.CreateButton(
|
||||||
const ALabel : String;
|
const ALabel : String;
|
||||||
const AResponse: Integer;
|
const AResponse: Integer;
|
||||||
|
@ -661,7 +661,6 @@ end;
|
|||||||
procedure TGtkListStoreStringList.Insert(Index: Integer; const S: String);
|
procedure TGtkListStoreStringList.Insert(Index: Integer; const S: String);
|
||||||
var
|
var
|
||||||
li: TGtkTreeIter;
|
li: TGtkTreeIter;
|
||||||
LCLIndex: PInteger;
|
|
||||||
begin
|
begin
|
||||||
if (Index < 0) or (Index > Count)
|
if (Index < 0) or (Index > Count)
|
||||||
then begin
|
then begin
|
||||||
|
Loading…
Reference in New Issue
Block a user