ADD: Protect call by critical section

This commit is contained in:
Alexander Koblov 2017-04-02 09:09:00 +00:00
commit f8f2d454bb
2 changed files with 27 additions and 17 deletions

View file

@ -125,28 +125,38 @@ end;
function TExifWdx.CallContentGetValueV(FileName: String; FieldIndex,
UnitIndex: Integer; flags: Integer): Variant;
begin
GetData(FileName);
case FieldIndex of
0: Result:= FExif.Make;
1: Result:= FExif.Model;
2: Result:= FExif.ImageWidth;
3: Result:= FExif.ImageHeight;
4: Result:= FExif.Orientation;
5: Result:= FExif.DateTimeOriginal;
EnterCriticalSection(FMutex);
try
GetData(FileName);
case FieldIndex of
0: Result:= FExif.Make;
1: Result:= FExif.Model;
2: Result:= FExif.ImageWidth;
3: Result:= FExif.ImageHeight;
4: Result:= FExif.Orientation;
5: Result:= FExif.DateTimeOriginal;
end;
finally
LeaveCriticalSection(FMutex);
end;
end;
function TExifWdx.CallContentGetValue(FileName: String; FieldIndex,
UnitIndex: Integer; flags: Integer): String;
begin
GetData(FileName);
case FieldIndex of
0: Result:= FExif.Make;
1: Result:= FExif.Model;
2: Result:= IntToStr(FExif.ImageWidth);
3: Result:= IntToStr(FExif.ImageHeight);
4: Result:= IntToStr(FExif.Orientation);
5: Result:= FExif.DateTimeOriginal;
EnterCriticalSection(FMutex);
try
GetData(FileName);
case FieldIndex of
0: Result:= FExif.Make;
1: Result:= FExif.Model;
2: Result:= IntToStr(FExif.ImageWidth);
3: Result:= IntToStr(FExif.ImageHeight);
4: Result:= IntToStr(FExif.Orientation);
5: Result:= FExif.DateTimeOriginal;
end;
finally
LeaveCriticalSection(FMutex);
end;
end;

View file

@ -55,7 +55,7 @@ type
{ TWDXModule }
TWDXModule = class
private
protected
FMutex: TRTLCriticalSection;
protected
function GetAName: String; virtual; abstract;