mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 19:09:19 +02:00
SynEdit: Apply locks before destructions. No need to update any internal values (e.g. caret pos) any more. Fix crash, when wrap and multi-caret active.
This commit is contained in:
parent
3d0e837d14
commit
098985e106
@ -923,6 +923,7 @@ type
|
|||||||
ATextDrawer: TheTextDrawer): TSynGutter; virtual;
|
ATextDrawer: TheTextDrawer): TSynGutter; virtual;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
|
procedure BeforeDestruction; override;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure AfterLoadFromFile;
|
procedure AfterLoadFromFile;
|
||||||
|
|
||||||
@ -2683,18 +2684,31 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCustomSynEdit.BeforeDestruction;
|
||||||
|
begin
|
||||||
|
inherited BeforeDestruction;
|
||||||
|
{$IFDEF SynCheckPaintLock}
|
||||||
|
if (FPaintLockOwnerCnt > 0) then begin
|
||||||
|
debugln(['TCustomSynEdit.Destroy: Paintlock=', FPaintLock, ' FInvalidateRect=', dbgs(FInvalidateRect)]);
|
||||||
|
DumpStack;
|
||||||
|
end;
|
||||||
|
{$ENDIF}
|
||||||
|
// block all events during destruction
|
||||||
|
inc(FPaintLock);
|
||||||
|
FMarkupManager.IncPaintLock;
|
||||||
|
FFoldedLinesView.Lock; //DecPaintLock triggers ScanRanges, and folds must wait
|
||||||
|
FTrimmedLinesView.Lock; // Lock before caret
|
||||||
|
FBlockSelection.Lock;
|
||||||
|
FCaret.Lock;
|
||||||
|
end;
|
||||||
|
|
||||||
destructor TCustomSynEdit.Destroy;
|
destructor TCustomSynEdit.Destroy;
|
||||||
var
|
var
|
||||||
i: integer;
|
i: integer;
|
||||||
p: TList;
|
p: TList;
|
||||||
begin
|
begin
|
||||||
Destroying;
|
Destroying;
|
||||||
{$IFDEF SynCheckPaintLock}
|
inc(FPaintLock); // block all events during destruction
|
||||||
if (FPaintLock > 0) then begin
|
|
||||||
debugln(['TCustomSynEdit.Destroy: Paintlock=', FPaintLock, ' FInvalidateRect=', dbgs(FInvalidateRect)]);
|
|
||||||
DumpStack;
|
|
||||||
end;
|
|
||||||
{$ENDIF}
|
|
||||||
Application.RemoveOnIdleHandler(@IdleScanRanges);
|
Application.RemoveOnIdleHandler(@IdleScanRanges);
|
||||||
SurrenderPrimarySelection;
|
SurrenderPrimarySelection;
|
||||||
Highlighter := nil;
|
Highlighter := nil;
|
||||||
|
Loading…
Reference in New Issue
Block a user