From: <sr...@us...> - 2006-02-13 07:25:54
|
Revision: 585 Author: srmitch Date: 2006-02-12 23:25:37 -0800 (Sun, 12 Feb 2006) ViewCVS: http://svn.sourceforge.net/instantobjects?rev=585&view=rev Log Message: ----------- Fix for SF BT #1426929 bug report. For an application compiled in D2006, adding entries into a new record in a DbGrid with an attached Selector results in an application crash (stack overflow) when trying to tab from the second column. Workaround comprises the addition of a semaphore variable to avoid recursion. Changes to InstantPresentation.pas: TInstantCustomExposer = class(TDataSet) private ... FContentModifiedList: TList; + FInSetFieldData: Boolean; FMemoList: TStrings; ... end; procedure TInstantCustomExposer.SetFieldData(Field: TField; Buffer: Pointer); begin if Assigned(Buffer) then Move(Buffer^, CurrentBuffer[GetFieldOffset(Field)], Field.DataSize) else FillChar(CurrentBuffer[GetFieldOffset(Field)], Field.DataSize, 0); - if not (State in [dsCalcFields, dsInternalCalc, dsFilter, dsNewValue]) then + if not (State in [dsCalcFields, dsInternalCalc, dsFilter, dsNewValue]) and + not FInSetFieldData then begin + FInSetFieldData := True; + try PostField(Field); DataEvent(deFieldChange, Longint(Field)); + finally + FInSetFieldData := False; + end; end; end; Modified Paths: -------------- trunk/Source/Core/InstantPresentation.pas Modified: trunk/Source/Core/InstantPresentation.pas =================================================================== --- trunk/Source/Core/InstantPresentation.pas 2006-02-13 07:09:19 UTC (rev 584) +++ trunk/Source/Core/InstantPresentation.pas 2006-02-13 07:25:37 UTC (rev 585) @@ -218,6 +218,7 @@ FAfterPostField: TInstantFieldEvent; FBeforePostField: TInstantFieldEvent; FContentModifiedList: TList; + FInSetFieldData: Boolean; FMemoList: TStrings; FOnCompare: TInstantCompareObjectsEvent; FOnCreateObject: TInstantCreateObjectEvent; @@ -2011,8 +2012,7 @@ Result := Accessor.CreateObject; end; -procedure TInstantCustomExposer.DataEvent(Event: TDataEvent; - Info: Integer); +procedure TInstantCustomExposer.DataEvent(Event: TDataEvent; Info: Longint); var I: Integer; DataSet: TDataSet; @@ -3742,10 +3742,16 @@ Move(Buffer^, CurrentBuffer[GetFieldOffset(Field)], Field.DataSize) else FillChar(CurrentBuffer[GetFieldOffset(Field)], Field.DataSize, 0); - if not (State in [dsCalcFields, dsInternalCalc, dsFilter, dsNewValue]) then + if not (State in [dsCalcFields, dsInternalCalc, dsFilter, dsNewValue]) and + not FInSetFieldData then begin - PostField(Field); - DataEvent(deFieldChange, Longint(Field)); + FInSetFieldData := True; + try + PostField(Field); + DataEvent(deFieldChange, Longint(Field)); + finally + FInSetFieldData := False; + end; end; end; |