mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-18 18:49:27 +02:00
* eoutofmemory and einvalidpointer fix
This commit is contained in:
parent
675b517bbe
commit
47a24b5da6
@ -254,12 +254,14 @@ Initialization
|
|||||||
InitExceptions; { Initialize exceptions. OS independent }
|
InitExceptions; { Initialize exceptions. OS independent }
|
||||||
InitInternational; { Initialize internationalization settings }
|
InitInternational; { Initialize internationalization settings }
|
||||||
Finalization
|
Finalization
|
||||||
OutOfMemory.Free;
|
DoneExceptions;
|
||||||
InValidPointer.Free;
|
|
||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.1 2001-06-02 19:26:03 peter
|
Revision 1.2 2001-06-03 15:18:01 peter
|
||||||
|
* eoutofmemory and einvalidpointer fix
|
||||||
|
|
||||||
|
Revision 1.1 2001/06/02 19:26:03 peter
|
||||||
* BeOS target!
|
* BeOS target!
|
||||||
|
|
||||||
}
|
}
|
@ -645,12 +645,14 @@ Initialization
|
|||||||
InitExceptions; { Initialize exceptions. OS independent }
|
InitExceptions; { Initialize exceptions. OS independent }
|
||||||
InitInternational; { Initialize internationalization settings }
|
InitInternational; { Initialize internationalization settings }
|
||||||
Finalization
|
Finalization
|
||||||
OutOfMemory.Free;
|
DoneExceptions;
|
||||||
InValidPointer.Free;
|
|
||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.4 2001-02-20 22:14:19 peter
|
Revision 1.5 2001-06-03 15:18:01 peter
|
||||||
|
* eoutofmemory and einvalidpointer fix
|
||||||
|
|
||||||
|
Revision 1.4 2001/02/20 22:14:19 peter
|
||||||
* merged getenvironmentvariable
|
* merged getenvironmentvariable
|
||||||
|
|
||||||
Revision 1.3 2000/08/30 06:29:19 michael
|
Revision 1.3 2000/08/30 06:29:19 michael
|
||||||
|
@ -475,13 +475,15 @@ Initialization
|
|||||||
InitExceptions; { Initialize exceptions. OS independent }
|
InitExceptions; { Initialize exceptions. OS independent }
|
||||||
InitInternational; { Initialize internationalization settings }
|
InitInternational; { Initialize internationalization settings }
|
||||||
Finalization
|
Finalization
|
||||||
OutOfMemory.Free;
|
DoneExceptions;
|
||||||
InValidPointer.Free;
|
|
||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.3 2001-04-16 18:39:50 florian
|
Revision 1.4 2001-06-03 15:18:01 peter
|
||||||
|
* eoutofmemory and einvalidpointer fix
|
||||||
|
|
||||||
|
Revision 1.3 2001/04/16 18:39:50 florian
|
||||||
* updates from Armin commited
|
* updates from Armin commited
|
||||||
|
|
||||||
Revision 1.2 2001/04/11 14:17:00 florian
|
Revision 1.2 2001/04/11 14:17:00 florian
|
||||||
|
@ -87,12 +87,17 @@ type
|
|||||||
public
|
public
|
||||||
ErrorCode : Longint;
|
ErrorCode : Longint;
|
||||||
end;
|
end;
|
||||||
EInvalidPointer = Class(Exception);
|
EHeapMemoryError = class(Exception)
|
||||||
EOutOfMemory = Class(Exception);
|
protected
|
||||||
|
AllowFree : boolean;
|
||||||
|
procedure FreeInstance;override;
|
||||||
|
end;
|
||||||
|
|
||||||
|
EInvalidPointer = Class(EHeapMemoryError);
|
||||||
|
EOutOfMemory = Class(EHeapMemoryError);
|
||||||
EAccessViolation = Class(Exception);
|
EAccessViolation = Class(Exception);
|
||||||
EInvalidCast = Class(Exception);
|
EInvalidCast = Class(Exception);
|
||||||
|
|
||||||
|
|
||||||
{ String conversion errors }
|
{ String conversion errors }
|
||||||
EConvertError = class(Exception);
|
EConvertError = class(Exception);
|
||||||
|
|
||||||
@ -142,7 +147,10 @@ Type
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.8 2001-02-20 22:14:19 peter
|
Revision 1.9 2001-06-03 15:18:01 peter
|
||||||
|
* eoutofmemory and einvalidpointer fix
|
||||||
|
|
||||||
|
Revision 1.8 2001/02/20 22:14:19 peter
|
||||||
* merged getenvironmentvariable
|
* merged getenvironmentvariable
|
||||||
|
|
||||||
Revision 1.7 2001/01/18 22:09:09 michael
|
Revision 1.7 2001/01/18 22:09:09 michael
|
||||||
|
@ -108,6 +108,12 @@
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure EHeapMemoryError.FreeInstance;
|
||||||
|
begin
|
||||||
|
if AllowFree then
|
||||||
|
inherited FreeInstance;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{$ifopt S+}
|
{$ifopt S+}
|
||||||
{$define STACKCHECK_WAS_ON}
|
{$define STACKCHECK_WAS_ON}
|
||||||
@ -210,12 +216,24 @@ begin
|
|||||||
ExceptProc:=@CatchUnhandledException;
|
ExceptProc:=@CatchUnhandledException;
|
||||||
// Create objects that may have problems when there is no memory.
|
// Create objects that may have problems when there is no memory.
|
||||||
OutOfMemory:=EOutOfMemory.Create(SOutOfMemory);
|
OutOfMemory:=EOutOfMemory.Create(SOutOfMemory);
|
||||||
|
OutOfMemory.AllowFree:=false;
|
||||||
InvalidPointer:=EInvalidPointer.Create(SInvalidPointer);
|
InvalidPointer:=EInvalidPointer.Create(SInvalidPointer);
|
||||||
|
InvalidPointer.AllowFree:=false;
|
||||||
AssertErrorProc:=@AssertErrorHandler;
|
AssertErrorProc:=@AssertErrorHandler;
|
||||||
ErrorProc:=@RunErrorToExcept;
|
ErrorProc:=@RunErrorToExcept;
|
||||||
OnShowException:=Nil;
|
OnShowException:=Nil;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
Procedure DoneExceptions;
|
||||||
|
begin
|
||||||
|
OutOfMemory.AllowFree:=true;
|
||||||
|
OutOfMemory.Free;
|
||||||
|
InValidPointer.AllowFree:=true;
|
||||||
|
InValidPointer.Free;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
{ Exception handling routines }
|
{ Exception handling routines }
|
||||||
|
|
||||||
function ExceptObject: TObject;
|
function ExceptObject: TObject;
|
||||||
@ -290,7 +308,10 @@ end;
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.3 2000-11-23 11:04:26 sg
|
Revision 1.4 2001-06-03 15:18:01 peter
|
||||||
|
* eoutofmemory and einvalidpointer fix
|
||||||
|
|
||||||
|
Revision 1.3 2000/11/23 11:04:26 sg
|
||||||
* Protected some Move()'s by 'if' clauses so that the Move won't be
|
* Protected some Move()'s by 'if' clauses so that the Move won't be
|
||||||
executed when the length would be 0. Otherwise, the corresponding
|
executed when the length would be 0. Otherwise, the corresponding
|
||||||
routines might get an RTE when compiled with $R+.
|
routines might get an RTE when compiled with $R+.
|
||||||
|
@ -769,13 +769,15 @@ Initialization
|
|||||||
InitExceptions; { Initialize exceptions. OS independent }
|
InitExceptions; { Initialize exceptions. OS independent }
|
||||||
InitInternational; { Initialize internationalization settings }
|
InitInternational; { Initialize internationalization settings }
|
||||||
Finalization
|
Finalization
|
||||||
OutOfMemory.Free;
|
DoneExceptions;
|
||||||
InValidPointer.Free;
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.11 2001-05-21 20:50:19 hajny
|
Revision 1.12 2001-06-03 15:18:01 peter
|
||||||
|
* eoutofmemory and einvalidpointer fix
|
||||||
|
|
||||||
|
Revision 1.11 2001/05/21 20:50:19 hajny
|
||||||
* silly mistyping corrected
|
* silly mistyping corrected
|
||||||
|
|
||||||
Revision 1.10 2001/05/20 18:40:33 hajny
|
Revision 1.10 2001/05/20 18:40:33 hajny
|
||||||
|
@ -460,13 +460,15 @@ Initialization
|
|||||||
InitExceptions; { Initialize exceptions. OS independent }
|
InitExceptions; { Initialize exceptions. OS independent }
|
||||||
InitInternational; { Initialize internationalization settings }
|
InitInternational; { Initialize internationalization settings }
|
||||||
Finalization
|
Finalization
|
||||||
OutOfMemory.Free;
|
DoneExceptions;
|
||||||
InValidPointer.Free;
|
|
||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.8 2001-02-20 22:19:38 peter
|
Revision 1.9 2001-06-03 15:18:01 peter
|
||||||
|
* eoutofmemory and einvalidpointer fix
|
||||||
|
|
||||||
|
Revision 1.8 2001/02/20 22:19:38 peter
|
||||||
* always test before commiting after merging, linux -> unix change
|
* always test before commiting after merging, linux -> unix change
|
||||||
|
|
||||||
Revision 1.7 2001/02/20 22:14:19 peter
|
Revision 1.7 2001/02/20 22:14:19 peter
|
||||||
|
@ -673,14 +673,16 @@ Initialization
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
Finalization
|
Finalization
|
||||||
OutOfMemory.Free;
|
DoneExceptions;
|
||||||
InValidPointer.Free;
|
|
||||||
if kernel32dll<>0 then
|
if kernel32dll<>0 then
|
||||||
FreeLibrary(kernel32dll);
|
FreeLibrary(kernel32dll);
|
||||||
end.
|
end.
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
Revision 1.8 2001-05-20 12:08:36 peter
|
Revision 1.9 2001-06-03 15:18:01 peter
|
||||||
|
* eoutofmemory and einvalidpointer fix
|
||||||
|
|
||||||
|
Revision 1.8 2001/05/20 12:08:36 peter
|
||||||
* fixed filesearch
|
* fixed filesearch
|
||||||
|
|
||||||
Revision 1.7 2001/04/16 10:57:05 peter
|
Revision 1.7 2001/04/16 10:57:05 peter
|
||||||
|
Loading…
Reference in New Issue
Block a user