mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-11 13:19:21 +02:00
SynEdit: Fixes a crash, PrimarySelection would make a callback to a destroyed SynEdit
git-svn-id: trunk@18848 -
This commit is contained in:
parent
a8f8934f62
commit
130c399660
@ -430,9 +430,8 @@ type
|
|||||||
fChangeStamp: int64;
|
fChangeStamp: int64;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
procedure AquirePrimarySelection;
|
procedure AquirePrimarySelection;
|
||||||
{$ENDIF}
|
procedure SurrenderPrimarySelection;
|
||||||
procedure BookMarkOptionsChanged(Sender: TObject);
|
procedure BookMarkOptionsChanged(Sender: TObject);
|
||||||
procedure ComputeCaret(X, Y: Integer);
|
procedure ComputeCaret(X, Y: Integer);
|
||||||
procedure DoBlockIndent;
|
procedure DoBlockIndent;
|
||||||
@ -1161,7 +1160,6 @@ end;
|
|||||||
|
|
||||||
{ TCustomSynEdit }
|
{ TCustomSynEdit }
|
||||||
|
|
||||||
{$IFDEF SYN_LAZARUS}
|
|
||||||
procedure TCustomSynEdit.AquirePrimarySelection;
|
procedure TCustomSynEdit.AquirePrimarySelection;
|
||||||
var
|
var
|
||||||
FormatList: TClipboardFormat;
|
FormatList: TClipboardFormat;
|
||||||
@ -1175,7 +1173,12 @@ begin
|
|||||||
except
|
except
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{$ENDIF}
|
|
||||||
|
procedure TCustomSynEdit.SurrenderPrimarySelection;
|
||||||
|
begin
|
||||||
|
if PrimarySelection.OnRequest=@PrimarySelectionRequest then
|
||||||
|
PrimarySelection.OnRequest:=nil;
|
||||||
|
end;
|
||||||
|
|
||||||
function TCustomSynEdit.PixelsToRowColumn(Pixels: TPoint): TPoint;
|
function TCustomSynEdit.PixelsToRowColumn(Pixels: TPoint): TPoint;
|
||||||
// converts the client area coordinate
|
// converts the client area coordinate
|
||||||
@ -1619,6 +1622,7 @@ destructor TCustomSynEdit.Destroy;
|
|||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
begin
|
begin
|
||||||
|
SurrenderPrimarySelection;
|
||||||
{$IFDEF SYN_LAZARUS}
|
{$IFDEF SYN_LAZARUS}
|
||||||
if HandleAllocated then LCLIntf.DestroyCaret(Handle);
|
if HandleAllocated then LCLIntf.DestroyCaret(Handle);
|
||||||
Beautifier:=nil;
|
Beautifier:=nil;
|
||||||
@ -7978,10 +7982,7 @@ begin
|
|||||||
{$IFDEF EnableDoubleBuf}
|
{$IFDEF EnableDoubleBuf}
|
||||||
FreeAndNil(BufferBitmap);
|
FreeAndNil(BufferBitmap);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
{$IFDEF SYN_LAZARUS}
|
SurrenderPrimarySelection;
|
||||||
if PrimarySelection.OnRequest=@PrimarySelectionRequest then
|
|
||||||
PrimarySelection.OnRequest:=nil;
|
|
||||||
{$ENDIF}
|
|
||||||
inherited DestroyWnd;
|
inherited DestroyWnd;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user