LazMapViewer: Lock list of gps items during painting.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8006 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2021-05-02 12:24:25 +00:00
parent ebe671bdf4
commit 9063163a69
2 changed files with 39 additions and 32 deletions

View File

@ -125,8 +125,6 @@ type
procedure _Delete(Idx: Integer; var DelLst: TGPSObjList);
procedure FreePending;
procedure DecRef;
procedure Lock;
procedure UnLock;
procedure CallModified(lst: TGPSObjList; Adding: boolean);
// property Items: TGPSObjList read FItems;
procedure IdsToObj(const Ids: TIdArray; out objs: TGPSObjArray; AIdOwner: integer);
@ -146,6 +144,9 @@ type
procedure BeginUpdate;
procedure EndUpdate;
procedure Lock;
procedure UnLock;
property Count: integer read GetCount;
property Items[AIndex: Integer]: TGpsObj read GetItem; default;
property OnModified: TModifiedEvent read FOnModified write FOnModified;

View File

@ -617,6 +617,8 @@ var
extent: TSize;
s: String;
begin
GPSItems.Lock;
try
if Assigned(FOnDrawGpsPoint) then begin
FOnDrawGpsPoint(Self, DrawingEngine, aPOI);
exit;
@ -651,6 +653,10 @@ begin
end;
extent := DrawingEngine.TextExtent(s);
DrawingEngine.Textout(Pt.X - extent.CX div 2, Pt.Y + 5, s);
finally
GPSItems.Unlock;
end;
end;
procedure TMapView.CallAsyncInvalidate;