Forum > General

TFPGMap issue after upgrade to FPC 3.2.0

<< < (3/4) > >>

engkin:
I think I found the bug. This procedure:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TFPGInterfacedObjectList.CopyItem(Src, Dest: Pointer);begin  if Assigned(Pointer(Dest^)) then    T(Dest^)._Release;  Pointer(Dest^) := Pointer(Src^);  if Assigned(Pointer(Dest^)) then    T(Dest^)._AddRef;end;
should increase the reference count of Src before reducing it for Dest, as in:

--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TFPGInterfacedObjectList.CopyItem(Src, Dest: Pointer);begin  if Assigned(Pointer(Src^)) then    T(Src^)._AddRef;  if Assigned(Pointer(Dest^)) then    T(Dest^)._Release;  Pointer(Dest^) := Pointer(Src^);end;
To test, copy fgl file to your project and change the file name and the unit name to something else like fgl2 and make the above mentioned modification. Finally, change the name of the unit in
 USES section in your project as well.

antispam88:
Changing the method

--- Quote ---    procedure TFPGInterfacedObjectList.CopyItem(Src, Dest: Pointer);
    begin
      if Assigned(Pointer(Src^)) then
        T(Src^)._AddRef;
      if Assigned(Pointer(Dest^)) then
        T(Dest^)._Release;
      Pointer(Dest^) := Pointer(Src^);
    end;
--- End quote ---

has no effect on my example.
I have attached the changed project as well as the output of the original fgl and the changed fgl2.

Best regards,
antispam88

engkin:
You are right, I have other changes in fgl I need to clean and make sure not to replace one bug with another. Your project might be a good way to test.

engkin:
Please test the attached file

antispam88:
The Init and the Adjust methods are now working.
But I have now included a Free method, which is not freeing the items - the TFPGList version does.
Best regards,
antispam88

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version