The problem could be that we allocate PString for TOvcTCComboBox data in tryGetMem, that is the first part of problem.
In tryGetMem we need to check type of cell to use GetMem insteed New(PString), tryFreeMem need to fix too
///TOvcTCComboBox data is not just a PString
if ((ACell is TOvcTCString) or (AField.DataType in [ftString, ftWideString])) and not (ACell is TOvcTCComboBox) then
New(PString(P))
else
GetMem(P, Size);
The second part is tbGetFieldValue we use allocated PString like a TCellComboBoxInfo
end else begin
/// looks OK if we use new(PString) in tryGetMem
PString(Data)^ := AField.Text;
/// still OK
if PString(Data)^ = '' then
Idx := -1
else
Idx := TOvcTCComboBox(ACell).Items.IndexOf(PString(Data)^);
/// we just damaged a string data, it stil not so critical
PCellComboBoxInfo(Data)^.Index := Idx;
if Idx = -1 then
if TOvcTCComboBox(ACell).Style in [csDropDown, csSimple] then
/// and now we try to store our damaged string into what?
PCellComboBoxInfo(Data)^.St := PString(Data)^ //S;
It works if change it to
end else begin
if AField.Text = '' then
Idx := -1
else
Idx := TOvcTCComboBox(ACell).Items.IndexOf(AField.Text);
PCellComboBoxInfo(Data)^.Index := Idx;
if Idx = -1 then
if TOvcTCComboBox(ACell).Style in [csDropDown, csSimple] then
PCellComboBoxInfo(Data)^.St := AField.Text;
The problem could be that we allocate PString for TOvcTCComboBox data in tryGetMem, that is the first part of problem. In tryGetMem we need to check type of cell to use GetMem insteed New(PString), tryFreeMem need to fix too
The second part is tbGetFieldValue we use allocated PString like a TCellComboBoxInfo
It works if change it to