Very similar to my fix, which I did minute ago.
We can more cleanup code by removing unneeded parts.
Please look at attached patch.
Thanks
L.
PS1: Yes it fixes AV
PS2: But still remains OldValue=null problem (see me 1st email)



Hi,

I committed a possible fix in rev. 17704. Please test.

Michael.

On Thu, 9 Jun 2011, LacaK wrote:

May be like this ?
Thanks.
Laco.

On Thu, 2011-06-09 at 11:49 +0200, LacaK wrote:

Here is attached debug output with {$DEFINE DSDebug}.
It seems, that exception is related to Append/Insert (it does not depend if dataset is empty before or not) followed by accesing OldValue


Can't you just post the backtrace? Joost.




_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel


--- bufdataset.pas.ori  Thu Jun 09 13:37:02 2011
+++ bufdataset.pas      Thu Jun 09 13:40:18 2011
@@ -1803,29 +1803,18 @@ begin
   if state = dsOldValue then
     begin
     if not GetActiveRecordUpdateBuffer then
-      begin
-      // There is no old value available
-      result := false;
-      exit;
-      end;
-    currbuff := FUpdateBuffer[FCurrentUpdateBuffer].OldValuesBuffer;
+      Exit; // There is no old value available
+    CurrBuff := FUpdateBuffer[FCurrentUpdateBuffer].OldValuesBuffer;
     end
   else
     CurrBuff := GetCurrentBuffer;
 
-  if not assigned(CurrBuff) then
-    begin
-    result := false;
-    exit;
-    end;
+  if not assigned(CurrBuff) then Exit;
 
   If Field.Fieldno > 0 then // If = 0, then calculated field or something 
similar
     begin
-    if GetFieldIsnull(pbyte(CurrBuff),Field.Fieldno-1) then
-      begin
-      result := false;
-      exit;
-      end;
+    if GetFieldIsNull(pbyte(CurrBuff),Field.FieldNo-1) then
+      Exit;
     if assigned(buffer) then
       begin
       inc(CurrBuff,FFieldBufPositions[Field.FieldNo-1]);
_______________________________________________
fpc-devel maillist  -  [email protected]
http://lists.freepascal.org/mailman/listinfo/fpc-devel

Reply via email to