Einzelnen Beitrag anzeigen

Fritzew

Registriert seit: 18. Nov 2015
Ort: Kehl
678 Beiträge
 
Delphi 11 Alexandria
 
#7

AW: AcquireExceptionObject() / ReleaseExceptionObject()

  Alt 31. Mai 2017, 15:36
Habe mal mit Berlin einen kleinen Test geschrieben:

Delphi-Quellcode:
procedure ttestexception.Test1;
var p : Pointer;
begin
  try
   Writeln('Test 1');

   raise etestexception.Create;
  except
   Writeln('Exceptblock 1');
   Writeln('AcquireExceptionObject');
   p := AcquireExceptionObject;
   ReleaseExceptionObject;
  end;
 Writeln('Leave Test1');

end;

procedure ttestexception.Test2;
var p : Pointer;
begin
  try
   writeln;
    Writeln('Test 2');

   raise etestexception.Create;
  except
   Writeln('Exceptblock 2');
  end;
 Writeln('Leave Test2');

end;

{ EtestException }

constructor EtestException.create;
begin
  inherited create('Test');
  writeln('Create EtestException ');
end;

destructor EtestException.Destroy;
begin
  writeln('Free EtestException ');
  inherited;
end;
Result:
Code:
Test 1
Create EtestException
Exceptblock 1
AcquireExceptionObject
Leave Test1

Test 2
Create EtestException
Exceptblock 2
Free EtestException
Leave Test2
Done
Wird also nicht freigegeben
Fritz Westermann
  Mit Zitat antworten Zitat