Forum > CustomDrawn
[SOLVED] Modification of TCDEdit's destructor
(1/1)
lagprogramming:
lcl/customdrawncontrols.pas has the following destructor:
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---destructor TCDEdit.Destroy;begin inherited Destroy; FLines.Free; //FCaretTimer.Free; Don't free here because it is assigned with a ownerend;inherited Destroy; is followed by a FLines.Free; line, where FLines is a TStringList.
The following patch modifies the destructor in order to free FLines before inherited Destroy;.
--- Code: Pascal [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---diff --git a/lcl/customdrawncontrols.pas b/lcl/customdrawncontrols.pasindex d9b6bb2035..2b852abf5c 100644--- a/lcl/customdrawncontrols.pas+++ b/lcl/customdrawncontrols.pas@@ -2044,8 +2044,8 @@ end; destructor TCDEdit.Destroy; begin- inherited Destroy; FLines.Free;+ inherited Destroy; //FCaretTimer.Free; Don't free here because it is assigned with a owner end;
Zvoni:
Interesting.
I was always under the impression, that Inherited Destroy; should always be called last in your own destructor (meaning cleaning up your own mess before .... )
AlexTP:
Posted to https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/40387
Navigation
[0] Message Index