From 92dde387852a9724b2d8e9d189ed31023a697d8d Mon Sep 17 00:00:00 2001 From: "Dmitry D. Chernov" Date: Fri, 8 Sep 2023 05:35:27 +1000 Subject: [PATCH] Fix a memory leak when selecting objects with a mouse-stretchable rectangle --- src/editor/f_main.pas | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/editor/f_main.pas b/src/editor/f_main.pas index 4d62e2e..58b6210 100644 --- a/src/editor/f_main.pas +++ b/src/editor/f_main.pas @@ -3759,7 +3759,12 @@ begin if Button = mbMiddle then MouseMDown := False; - DrawRect := nil; + if DrawRect <> nil then + begin + Dispose(DrawRect); + DrawRect := nil; + end; + ResizeType := RESIZETYPE_NONE; TextureID := 0; @@ -4324,8 +4329,11 @@ begin end; // Клавиши мыши не зажаты: - if (not MouseRDown) and (not MouseLDown) then + if (not MouseRDown) and (not MouseLDown) and (DrawRect <> nil) then + begin + Dispose(DrawRect); DrawRect := nil; + end; // Строка состояния - координаты мыши: StatusBar.Panels[1].Text := Format('(%d:%d)', -- 2.29.2