C++ compiling error when FreeAndNil of private properties in an inherited structure with version 9.2.102.1293

Hello,

I spoke too soon my previous post. In another project, somewhat more complex, I’m getting a compiling error with the generated _Intf unit. I’m trying the gamma version 9.2.102.1293.

The problem occurs inside a ReadComplex method, in a structure inherited from another one that includes a third structure: I have an Address structure, then a Customer structure (which includes an Address structure) and a ExtendedCustomer inherited from Customer.

The error happens in the ReadComplex method of ExtendedCustomer, as the fAddress pointer is private to Customer, so the FreeAndNil fails with a compiler error E2247 “TCustomer::fAddress is not accesible”.

Here is the exact code:

	l_Direccion = this->int_Direccion;
	try
	{
		__Serializer->ReadStruct("Direccion", __classid(msaCI1ClientInterface::TDireccion),  &l_Direccion);
	}
	catch (Exception* E)
	{
		Uroclasses::RaiseError("Exception \"%s\" with message \"%s\" happens during reading field \"%s\".", ARRAYOFCONST((E->ClassName(), E->Message, "Direccion")));
	}
	if (this->int_Direccion != l_Direccion)
		FreeAndNil(this->fDireccion); // <-- this is the offending line.
	this->Direccion = l_Direccion;

I checked the Delphi code and as far as I can see (without trying to compile it) it produces something equivalent (the member is Private) but I don’t remember if the rules in Delphi are different regarding this.

Any recommendations to fix this? Hopefully you can get a fix for this for the RTM build.

Thanks

Thanks, logged as bugs://77561

bugs://77561 got closed with status fixed.

RTM was already created.
the fix will be in the next beta

Thank you Evgeny,

Any idea when the next beta will be available? I am not able to compile the codegen libraries myself.

For now I modified the generated file to use the Field directly, instead of fField. This at least compiles and should work… but I don’t know what route you took for the fix.

you can disable regeneration of _Intf and replace delete this->f with delete this->int_ like

delete this->fNewField;

with

delete this->int_NewField;

Ok, I will change the code to use the int_ version. Thanks.