Ver código fonte

* Raise exception if BasicEventCreate fails in constructor (bug ID 30769)

git-svn-id: trunk@34988 -
michael 8 anos atrás
pai
commit
76f7f81c85
1 arquivos alterados com 9 adições e 0 exclusões
  1. 9 0
      packages/fcl-base/src/syncobjs.pp

+ 9 - 0
packages/fcl-base/src/syncobjs.pp

@@ -28,6 +28,10 @@ const
   INFINITE = Cardinal(-1);
 
 type
+   ESyncObjectException = Class(Exception);
+   ELockException = Class(ESyncObjectException);
+   ELockRecursionException = Class(ESyncObjectException);
+   
    TWaitResult = (wrSignaled, wrTimeout, wrAbandoned, wrError);
 
    TSynchroObject = class(TObject)
@@ -79,6 +83,9 @@ type
 
 implementation
 
+Resourcestring
+  SErrEventCreateFailed = 'Failed to create OS basic event with name "%s"'; 
+
 { ---------------------------------------------------------------------
     Real syncobjs implementation
   ---------------------------------------------------------------------}
@@ -150,6 +157,8 @@ constructor TEventObject.Create(EventAttributes : PSecurityAttributes;
 
 begin
   FHandle := BasicEventCreate(EventAttributes, AManualReset, InitialState, Name);
+  if (FHandle=Nil) then
+    Raise ESyncObjectException.CreateFmt(SErrEventCreateFailed,[Name]);
   FManualReset:=AManualReset;
 end;