Browse Source

* fix for exception handling - avoid endless loop in case of fatal exceptions, safer checking for prefetch bug

git-svn-id: trunk@15131 -
Tomas Hajny 15 years ago
parent
commit
a87a867271
1 changed files with 6 additions and 3 deletions
  1. 6 3
      rtl/os2/system.pas

+ 6 - 3
rtl/os2/system.pas

@@ -172,8 +172,8 @@ function Is_Prefetch (P: pointer): boolean;
     Is_Prefetch := false;
     Is_Prefetch := false;
 
 
     MemSize := SizeOf (A);
     MemSize := SizeOf (A);
-    DosQueryMem (P, MemSize, MemAttrs);
-    if (MemAttrs and (mfPag_Free or mfPag_Commit) <> 0)
+    if (DosQueryMem (P, MemSize, MemAttrs) = 0) and
+            (MemAttrs and (mfPag_Free or mfPag_Commit) <> 0)
                                                and (MemSize >= SizeOf (A)) then
                                                and (MemSize >= SizeOf (A)) then
      Move (P^, A [0], SizeOf (A))
      Move (P^, A [0], SizeOf (A))
     else
     else
@@ -396,7 +396,10 @@ begin
      end;
      end;
    end;
    end;
 
 
-   if (Err <> 0) and (ExceptLevel < MaxExceptionLevel) then
+   if (Err <> 0) and (ExceptLevel < MaxExceptionLevel) 
+(* TH: The following line is necessary to avoid an endless loop *)
+                 and (Report^.Exception_Num < Xcpt_Process_Terminate)
+                                                                    then
     begin
     begin
      ExceptEIP [ExceptLevel] := Context^.Reg_EIP;
      ExceptEIP [ExceptLevel] := Context^.Reg_EIP;
      ExceptError [ExceptLevel] := Err;
      ExceptError [ExceptLevel] := Err;