AIS_Plane SetSize crash going from 7.5 to 7.8

The next code


		Handle(Geom_Plane)	hRefPlane0;
		hRefPlane0 = new Geom_Plane(gp_Pnt(0, 0, 0), gpDirRef);
		Handle(AIS_Plane)	hRefbottomPlane = new AIS_Plane(hRefPlane0);
		hRefbottomPlane->SetSize(500.0, 500.0);
		hRefbottomPlane->SetColor(Quantity_NOC_LAWNGREEN);
		aShapes.Append(hRefbottomPlane);

worked in 7.5 but crashes in 7.8.
This happens in SetSize, where in 7.5 the line PA = myDrawer->PlaneAspect(); gives a valid address, in 7.8 it gets a nullptr.
In the next lines the (AIS_Plane_cxx lines 344 to 350) PA is also not created with the result that the line 353 (PA->SetPlaneLength(aXLength,aYLength);) is executed with a null pointer.

Looking at Mantis (0032704) i see this was changed in 7.7.
I don't find anything back in the 7.7 release notes, so is this a bug?

gkv311 n's picture

Indeed, the code within AIS_Plane::SetSize() and AIS_Plane::SetColor() looks outdated and broken.

Calling Prs3d_Drawer::SetOwnDatumAspects() should help.

Handle(Geom_Plane) hRefPlane0 =
  new Geom_Plane(gp_Pnt(0, 0, 0), gpDirRef);
Handle(AIS_Plane) hRefbottomPlane =
  new AIS_Plane(hRefPlane0);

hRefbottomPlane->Attributes()->
  SetOwnDatumAspects(theContext->DefaultDrawer()); ///

hRefbottomPlane->SetSize(500.0, 500.0);
hRefbottomPlane->SetColor(Quantity_NOC_LAWNGREEN);
Luc Wens's picture

Thanks!