View Issue Details

IDProjectCategoryView StatusLast Update
0033517FPCRTLpublic2018-04-07 21:02
ReporterFiliuta VitaliAssigned ToMichael Van Canneyt 
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version3.1.1Product Build 
Target Version3.2.0Fixed in Version3.1.1 
Summary0033517: Fix for TCollection.Assign
DescriptionI think, it is better to put instructions

  Clear;
  For I:=0 To TCollection(Source).Count-1 do
    Add.Assign(TCollection(Source).Items[I]);

from TCollection.Assign method into BeginUpdate...EndUpdate bounds, so we will get single call of Update notification method for whole assign, inplace of multiple calls of them: one for Clear (if not empty), and one for each added collection item.

Patch is attached.
TagsNo tags attached.
Fixed in Revision38628
FPCOldBugId
FPCTarget
Attached Files
  • collect.Assign.diff (603 bytes)
    Index: rtl/objpas/classes/collect.inc
    ===================================================================
    --- rtl/objpas/classes/collect.inc	(revision 38588)
    +++ rtl/objpas/classes/collect.inc	(working copy)
    @@ -324,9 +324,14 @@
     begin
       If Source is TCollection then
         begin
    -    Clear;
    -    For I:=0 To TCollection(Source).Count-1 do
    -     Add.Assign(TCollection(Source).Items[I]);
    +    BeginUpdate;
    +    try
    +      Clear;
    +      For I:=0 To TCollection(Source).Count-1 do
    +       Add.Assign(TCollection(Source).Items[I]);
    +    finally
    +      EndUpdate;
    +    end;
         exit;
         end
       else
    
    collect.Assign.diff (603 bytes)

Activities

Filiuta Vitali

2018-03-26 20:49

reporter  

collect.Assign.diff (603 bytes)
Index: rtl/objpas/classes/collect.inc
===================================================================
--- rtl/objpas/classes/collect.inc	(revision 38588)
+++ rtl/objpas/classes/collect.inc	(working copy)
@@ -324,9 +324,14 @@
 begin
   If Source is TCollection then
     begin
-    Clear;
-    For I:=0 To TCollection(Source).Count-1 do
-     Add.Assign(TCollection(Source).Items[I]);
+    BeginUpdate;
+    try
+      Clear;
+      For I:=0 To TCollection(Source).Count-1 do
+       Add.Assign(TCollection(Source).Items[I]);
+    finally
+      EndUpdate;
+    end;
     exit;
     end
   else
collect.Assign.diff (603 bytes)

Michael Van Canneyt

2018-03-26 21:03

administrator   ~0107429

Checked and applied, thank you very much!

Issue History

Date Modified Username Field Change
2018-03-26 20:49 Filiuta Vitali New Issue
2018-03-26 20:49 Filiuta Vitali File Added: collect.Assign.diff
2018-03-26 21:00 Michael Van Canneyt Assigned To => Michael Van Canneyt
2018-03-26 21:00 Michael Van Canneyt Status new => assigned
2018-03-26 21:03 Michael Van Canneyt Fixed in Revision => 38628
2018-03-26 21:03 Michael Van Canneyt Note Added: 0107429
2018-03-26 21:03 Michael Van Canneyt Status assigned => resolved
2018-03-26 21:03 Michael Van Canneyt Fixed in Version => 3.1.1
2018-03-26 21:03 Michael Van Canneyt Resolution open => fixed
2018-03-26 21:03 Michael Van Canneyt Target Version => 3.2.0
2018-04-07 21:02 Filiuta Vitali Status resolved => closed