#1 2015-07-20 10:52:47

sadam
Member
From: Warsaw, Poland
Registered: 2015-07-20
Posts: 2

TSynTable Data method hangs Delphi 2006 IDE

Nightly build:
mORMot_and_Open_Source_friends_2015-07-19_181637_e608189d05

tested :
TestSQL3.dpr
(as in documetation FAQ to start from :-))

In version mORMot_and_Open_Source_friends_2015-07-15_142654_62e5a5e417 the test went without fails under XE3 and Windows 7 Prof. It hangs the IDE of Delphi 2006. On Windows 7 prof. and on Windows XP.

Version mORMot_and_Open_Source_friends_2015-07-19_181637_e608189d05 hangs the Delphi 2006 IDE too.

The problem encountered when the IDE tries to step the line below (with my comment):

function TSynTable.Data(aID: integer; RecordBuffer: pointer; RecordBufferLen: Integer): Variant;
begin
  if SynTableVariantType=nil then
    SynTableVariantType := SynRegisterCustomVariantType(TSynTableVariantType);
  if TVarData(result).VType and VTYPE_STATIC<>0 then
    VarClear(result);
  with TSynTableData(result) do begin
    VType := SynTableVariantType.VarType;
    VID := aID;                                       { <---- here the problem starts }
    VTable := self;
    PtrInt(VValue) := 0; // avoid GPF
    if RecordBuffer=nil then
      VValue := DefaultRecordData else begin
      if RecordBufferLen=0 then
        RecordBufferLen := DataLength(RecordBuffer);
      SetString(VValue,PAnsiChar(RecordBuffer),RecordBufferLen);
    end;
  end;
end;

It is called from procedure TTestLowLevelCommon._TSynTable in such way:

      // test TSynTableVariantType
      rec := T.Data;

Best Regards
Sadam

Last edited by sadam (2015-07-20 10:54:33)

Offline

#2 2015-07-20 16:16:35

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,272
Website

Re: TSynTable Data method hangs Delphi 2006 IDE

Offline

#3 2015-07-21 22:46:02

sadam
Member
From: Warsaw, Poland
Registered: 2015-07-20
Posts: 2

Re: TSynTable Data method hangs Delphi 2006 IDE

Still hangs. Seems the problem is in the line:

data.VType := SynTableVariantType.VarType;

which is before. IDE hangs when it performs it.

SynTableVariantType.VarType has value 273 here. And that value isn't accepted in data.VType. Means that line:

data.VType := SynTableVariantType.VarType - 1;

doesn't hangs IDE. Maybe I'm wrong, but when IDE performs line:

SynTableVariantType := SynRegisterCustomVariantType(TSynTableVariantType);

a new variant is registered and added to list:

  result :=  aClass.Create; // register variant type
  SynVariantTypes.Add(result);

The last (third) element of that list has 273 as VarType value. The previous (second) has 272 and such value is accepted. Seems that accepted values begins from 0 and ends at 272. Some of them I checked and the IDE doesn't hangs. But with 273 (even written directly as constant in code) it hangs. I hope it helps.

Last edited by sadam (2015-07-23 14:54:14)

Offline

Board footer

Powered by FluxBB