View Issue Details

IDProjectCategoryView StatusLast Update
0035451LazarusLCLpublic2019-08-06 18:32
ReporterSerge AnvarovAssigned ToJuha Manninen 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version2.1 (SVN)Product Build 
Target VersionFixed in Version 
Summary0035451: Function DefaultInputDialog creates and free the form without a "try finally" block
DescriptionIf an error occurs during autosizing controls, there will be a memory leak
Steps To Reproducevar
  V: string = '';
begin
  DefaultInputDialog('', StringOfChar('1', 10000), False, V);
end;
Additional InformationPatch included
TagsNo tags attached.
Fixed in Revisionr61064
LazTarget-
WidgetsetWin32/Win64
Attached Files
  • DefaultInputDialog.diff (572 bytes)
    Index: lcl/include/inputdialog.inc
    ===================================================================
    --- lcl/include/inputdialog.inc	(revision 61055)
    +++ lcl/include/inputdialog.inc	(working copy)
    @@ -33,7 +33,7 @@
       Form.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('ShowInputDialog'){$ENDIF};
       Form.CreateNew(nil, 0);
       with Form do
    -  begin
    +  try
         PopupMode := pmAuto;
         BorderStyle := bsDialog;
         Caption := InputCaption;
    @@ -95,6 +95,7 @@
           Value := Edit.Text;
           Result := True;
         end;
    +  finally
         Form.Free;
       end;
     end;
    

Activities

Serge Anvarov

2019-04-26 15:14

reporter  

DefaultInputDialog.diff (572 bytes)
Index: lcl/include/inputdialog.inc
===================================================================
--- lcl/include/inputdialog.inc	(revision 61055)
+++ lcl/include/inputdialog.inc	(working copy)
@@ -33,7 +33,7 @@
   Form.DisableAutoSizing{$IFDEF DebugDisableAutoSizing}('ShowInputDialog'){$ENDIF};
   Form.CreateNew(nil, 0);
   with Form do
-  begin
+  try
     PopupMode := pmAuto;
     BorderStyle := bsDialog;
     Caption := InputCaption;
@@ -95,6 +95,7 @@
       Value := Edit.Text;
       Result := True;
     end;
+  finally
     Form.Free;
   end;
 end;

Juha Manninen

2019-04-26 18:09

developer   ~0115830

Applied, thanks.

Serge Anvarov

2019-08-06 18:32

reporter   ~0117582

In release 2.0.4

Issue History

Date Modified Username Field Change
2019-04-26 15:14 Serge Anvarov New Issue
2019-04-26 15:14 Serge Anvarov File Added: DefaultInputDialog.diff
2019-04-26 17:35 Juha Manninen Assigned To => Juha Manninen
2019-04-26 17:35 Juha Manninen Status new => assigned
2019-04-26 18:09 Juha Manninen Status assigned => resolved
2019-04-26 18:09 Juha Manninen Resolution open => fixed
2019-04-26 18:09 Juha Manninen Fixed in Revision => r61064
2019-04-26 18:09 Juha Manninen LazTarget => -
2019-04-26 18:09 Juha Manninen Widgetset Win32/Win64 => Win32/Win64
2019-04-26 18:09 Juha Manninen Note Added: 0115830
2019-08-06 18:32 Serge Anvarov Status resolved => closed
2019-08-06 18:32 Serge Anvarov Note Added: 0117582