mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 16:19:28 +02:00
SynEdit: Wrapped-view, fix leaks. Remove event-handler and view in Destroy
(cherry picked from commit e331c9fb35
)
This commit is contained in:
parent
2b4decdf35
commit
5ae99331c1
@ -2682,6 +2682,7 @@ var
|
|||||||
i: integer;
|
i: integer;
|
||||||
p: TList;
|
p: TList;
|
||||||
begin
|
begin
|
||||||
|
Destroying;
|
||||||
{$IFDEF SynCheckPaintLock}
|
{$IFDEF SynCheckPaintLock}
|
||||||
if (FPaintLock > 0) then begin
|
if (FPaintLock > 0) then begin
|
||||||
debugln(['TCustomSynEdit.Destroy: Paintlock=', FPaintLock, ' FInvalidateRect=', dbgs(FInvalidateRect)]);
|
debugln(['TCustomSynEdit.Destroy: Paintlock=', FPaintLock, ' FInvalidateRect=', dbgs(FInvalidateRect)]);
|
||||||
|
@ -221,6 +221,7 @@ public
|
|||||||
function CalculateWrapForLine(ALineIdx: IntIdx; AMaxWidth: integer): Integer; inline;
|
function CalculateWrapForLine(ALineIdx: IntIdx; AMaxWidth: integer): Integer; inline;
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
|
destructor Destroy; override;
|
||||||
|
|
||||||
procedure WrapAll; experimental;
|
procedure WrapAll; experimental;
|
||||||
procedure ValidateAll; experimental;
|
procedure ValidateAll; experimental;
|
||||||
@ -1811,6 +1812,18 @@ begin
|
|||||||
WrapAll;
|
WrapAll;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
destructor TLazSynEditLineWrapPlugin.Destroy;
|
||||||
|
begin
|
||||||
|
if Editor <> nil then begin
|
||||||
|
TSynEdit(Editor).UnRegisterStatusChangedHandler(@DoWidthChanged);
|
||||||
|
if (FLineMapView <> nil) and not (csDestroying in Editor.Componentstate) then begin
|
||||||
|
TSynEdit(Editor).TextViewsManager.RemoveSynTextView(FLineMapView, True);
|
||||||
|
TSynEdit(Editor).Invalidate;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TLazSynEditLineWrapPlugin.WrapAll;
|
procedure TLazSynEditLineWrapPlugin.WrapAll;
|
||||||
var
|
var
|
||||||
c: Integer;
|
c: Integer;
|
||||||
|
Loading…
Reference in New Issue
Block a user