Changeset 38 for trunk


Ignore:
Timestamp:
Mar 8, 2012, 3:40:45 PM (13 years ago)
Author:
chronos
Message:
  • Fixed: SqlDatabase object initialized twice and freed once.
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Application/Clients/UChronisClientMySQL.pas

    r37 r38  
    159159destructor TChronisClientMySQL.Destroy;
    160160begin
    161   Database.Free;
     161  FreeAndNil(Database);
    162162  inherited Destroy;
    163163end;
  • trunk/Forms/UImportStructureForm.pas

    r21 r38  
    9494procedure TImportStructureForm.FormShow(Sender: TObject);
    9595begin
    96   EditHost.Text := Core.SqlDatabase1.HostName;
    97   EditUser.Text := Core.SqlDatabase1.UserName;
    98   EditSchema.Text := Core.SqlDatabase1.Database;
     96  EditHost.Text := Core.System.Client.Host;
     97  EditUser.Text := Core.System.Client.User;
     98  EditSchema.Text := Core.System.Client.Schema;
    9999end;
    100100
  • trunk/Forms/UMainForm.pas

    r37 r38  
    170170procedure TMainForm.FormDestroy(Sender: TObject);
    171171begin
    172   Report.Free;
    173   TreeState.Free;
    174   PersistentForm.Free;
     172  FreeAndNil(Report);
     173  FreeAndNil(TreeState);
     174  FreeAndNil(PersistentForm);
    175175end;
    176176
     
    254254procedure TMainForm.AConnectExecute(Sender: TObject);
    255255begin
     256  try
     257    LoginForm := TLoginForm.Create(MainForm);
    256258  Core.Profiles.LoadFromRegistry(Core.RegistryRootKey, Core.RegistryKey);
    257259  if LoginForm.ShowModal = mrOK then begin
     
    273275    end;
    274276  end;
     277  finally
     278    LoginForm.Free;
     279  end;
    275280end;
    276281
     
    304309procedure TMainForm.MenuItem17Click(Sender: TObject);
    305310begin
    306   LoginForm.ShowModal;
     311  try
     312    LoginForm := TLoginForm.Create(MainForm);
     313    LoginForm.ShowModal;
     314  finally
     315    LoginForm.Free;
     316  end;
    307317end;
    308318
  • trunk/UCore.lfm

    r33 r38  
    1212    top = 55
    1313  end
    14   object SqlDatabase1: TSqlDatabase
    15     Connected = False
    16     Port = 3306
    17     Encoding = 'utf8'
    18     OnLogQuery = SqlDatabase1LogQuery
    19     left = 200
    20     top = 55
    21   end
    2214  object DebugLog1: TDebugLog
    2315    WriteToFileEnable = False
  • trunk/UCore.pas

    r37 r38  
    1616    CoolTranslator1: TCoolTranslator;
    1717    DebugLog1: TDebugLog;
    18     SqlDatabase1: TSqlDatabase;
    1918    procedure DataModuleCreate(Sender: TObject);
    2019    procedure DataModuleDestroy(Sender: TObject);
     
    5655  System := TChronisBase.Create;
    5756  System.Client := TChronisClientMySQL.Create;
    58   TChronisClientMySQL(System.Client).Database := SqlDatabase1;
     57  //TChronisClientMySQL(System.Client).Database := SqlDatabase1;
    5958  System.RegisterModule(TModuleSystem);
    6059  System.ModuleSystem := TModuleSystem(System.Modules.Last);
     
    6867begin
    6968  SaveToRegistry;
    70   System.Free;
    71   Profiles.Free;
     69  FreeAndNil(System);
     70  FreeAndNil(Profiles);
    7271end;
    7372
  • trunk/USystem.pas

    r37 r38  
    658658destructor TChronisBase.Destroy;
    659659begin
    660   Types.Free;
    661   Modules.Free;
    662   Client.Free;
     660  FreeAndNil(Types);
     661  FreeAndNil(Modules);
     662  FreeAndNil(Client);
    663663  inherited Destroy;
    664664end;
  • trunk/chronis.lpi

    r36 r38  
    291291        <StackChecks Value="True"/>
    292292      </Checks>
     293      <VerifyObjMethodCallValidity Value="True"/>
    293294    </CodeGeneration>
    294295    <Linking>
    295296      <Debugging>
    296         <DebugInfoType Value="dsStabs"/>
    297297        <UseHeaptrc Value="True"/>
    298298      </Debugging>
  • trunk/chronis.lpr

    r36 r38  
    3535  Application.CreateForm(TCore, Core);
    3636  Application.CreateForm(TMainForm, MainForm);
    37   Application.CreateForm(TLoginForm, LoginForm);
    38   Application.CreateForm(TImportStructureForm, ImportStructureForm);
    39   Application.CreateForm(TLoginProfileForm, LoginProfileForm);
    4037  Application.Run;
    4138end.
Note: See TracChangeset for help on using the changeset viewer.