OSDN Git Service

メモリリーク対策
authorh677 <h677>
Tue, 16 Mar 2004 15:37:55 +0000 (15:37 +0000)
committerh677 <h677>
Tue, 16 Mar 2004 15:37:55 +0000 (15:37 +0000)
BoardGroup.pas
Favorite.pas
Giko.pas
RoundData.pas

index b115433..47b14bc 100644 (file)
@@ -503,6 +503,7 @@ var
 begin
        for i := Count - 1 downto 0 do
                Delete(i);
+    Capacity := Count;
 end;
 
 function TBBS.Find(key: string): TCategory;
@@ -663,6 +664,7 @@ var
 begin
        for i := Count - 1 downto 0 do
                Delete(i);
+    Capacity := Count;
 end;
 
 function TCategory.FindName(key: string): TBoard;
@@ -904,6 +906,7 @@ begin
 //     FUnRead := 0;
        for i := Count - 1 downto 0 do
                Delete(i);
+    Capacity := Count;
 end;
 
 function TBoard.Find(ItemFileName: string): TThreadItem;
index 80e6269..e13cf4a 100644 (file)
@@ -188,6 +188,7 @@ begin
        for i := 0 to TreeView.Items.Count - 1 do begin
                TObject(TreeView.Items[i].Data).Free;
        end;
+    TreeView.Free;
 end;
 
 procedure TFavoriteDM.SetFavTreeView(TreeView: TTreeView);
index 4329bcc..ca4f296 100644 (file)
--- a/Giko.pas
+++ b/Giko.pas
@@ -928,6 +928,7 @@ type
 //             procedure SetStdToolBar;
 //             function GetAction(ActionName: string): TContainedAction;
                procedure SetLinkBar;
+        procedure ClearLinkBar;
                function GetWidthAllToolButton(ToolBar: TToolBar): Integer;
                procedure MenuBarChevronMenu;
                procedure LinkBarChevronMenu;
@@ -1683,7 +1684,10 @@ begin
        except
        end;
 
-
+    try
+       ClearLinkBar;
+    except
+    end;
 
 //     FDownload.Free;
        try
@@ -1698,6 +1702,10 @@ begin
                TreeView.Items.Clear;
        except
        end;
+    try
+       FavoriteTreeView.Items.Clear;
+    except
+    end;
 
        try
                if FavoriteDM <> nil then
@@ -6546,10 +6554,13 @@ end;
 
 procedure TGikoForm.WndProc(var Message: TMessage);
 begin
-       if (Message.Msg = CM_DIALOGCHAR) then
-               if not (ssAlt in KeyDataToShiftState(TWMChar(Message).KeyData)) then
-                       Exit;
-       inherited;
+    try
+               if (Message.Msg = CM_DIALOGCHAR) then
+                       if not (ssAlt in KeyDataToShiftState(TWMChar(Message).KeyData)) then
+                               Exit;
+               inherited;
+    except
+    end;
 end;
 
 procedure TGikoForm.FormShortCut(var Msg: TWMKey; var Handled: Boolean);
@@ -7044,7 +7055,19 @@ begin
                MainCoolBar.Bands.EndUpdate;
        end;
 end;
-
+procedure TGikoForm.ClearLinkBar;
+var
+       i: Integer;
+begin
+       MainCoolBar.Bands.BeginUpdate;
+       try
+               LinkBarPopupMenu.Items.Clear;
+               for i := LinkToolBar.ButtonCount - 1 downto 0 do
+                       LinkToolBar.RemoveControl(LinkToolBar.Buttons[i]);
+    finally
+               MainCoolBar.Bands.EndUpdate;
+       end;
+end;
 procedure TGikoForm.FavoriteDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
 var
        Node: TTreeNode;
index 219f450..4f65064 100644 (file)
@@ -180,11 +180,13 @@ begin
                        TRoundItem(FBoardList[i]).Free;
                FBoardList.Delete(i);
        end;
+    FBoardList.Capacity := FBoardList.Count;
        for i := FItemList.Count - 1 downto 0 do begin
         if FItemList[i] <> nil then
                        TRoundItem(FItemList[i]).Free;
                FItemList.Delete(i);
        end;
+    FItemList.Capacity := FItemList.Count;
 end;
 
 function TRoundList.Find(Board: TBoard): Integer;
@@ -455,6 +457,7 @@ begin
                errorSl.SaveToFile(errorFileName);
                end;
        finally
+        errorSl.Free;
                sl.Free;
 //        boardList.Free;
        end;