mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-21 10:13:43 +03:00
0030588: Coding - avoid calling operator->() on NULL Handle
Use .get() method instead of operator->() where result can be NULL. STEPCAFControl_Reader::ReadLayers(), XCAFDoc_ColorTool, XCAFDoc_LayerTool::SetVisibility() - fixed static functions syntax.
This commit is contained in:
parent
18434846a3
commit
ad67e36766
@ -67,7 +67,7 @@ Standard_Boolean Expr_NamedExpression::IsIdentical
|
|||||||
|
|
||||||
//AGV 22.03.12: Comparison should be based on names rather than Handles
|
//AGV 22.03.12: Comparison should be based on names rather than Handles
|
||||||
const Expr_NamedExpression* pOther =
|
const Expr_NamedExpression* pOther =
|
||||||
static_cast<const Expr_NamedExpression*>(theOther.operator->());
|
static_cast<const Expr_NamedExpression*>(theOther.get());
|
||||||
if (pOther == this || pOther->GetName().IsEqual(myName))
|
if (pOther == this || pOther->GetName().IsEqual(myName))
|
||||||
aResult = Standard_True;
|
aResult = Standard_True;
|
||||||
}
|
}
|
||||||
|
@ -215,9 +215,9 @@ void MAT_Arc::SetFirstArc(const MAT_Side aSide ,
|
|||||||
const Handle(MAT_Arc)& anArc)
|
const Handle(MAT_Arc)& anArc)
|
||||||
{
|
{
|
||||||
if (aSide == MAT_Left)
|
if (aSide == MAT_Left)
|
||||||
firstArcLeft = anArc.operator->();
|
firstArcLeft = anArc.get();
|
||||||
else
|
else
|
||||||
firstArcRight = anArc.operator->();
|
firstArcRight = anArc.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -228,9 +228,9 @@ void MAT_Arc::SetSecondArc(const MAT_Side aSide ,
|
|||||||
const Handle(MAT_Arc)& anArc)
|
const Handle(MAT_Arc)& anArc)
|
||||||
{
|
{
|
||||||
if (aSide == MAT_Left)
|
if (aSide == MAT_Left)
|
||||||
secondArcLeft = anArc.operator->();
|
secondArcLeft = anArc.get();
|
||||||
else
|
else
|
||||||
secondArcRight = anArc.operator->();
|
secondArcRight = anArc.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
@ -243,17 +243,17 @@ void MAT_Arc::SetNeighbour(const MAT_Side aSide,
|
|||||||
{
|
{
|
||||||
if (aSide == MAT_Left) {
|
if (aSide == MAT_Left) {
|
||||||
if (aNode == FirstNode())
|
if (aNode == FirstNode())
|
||||||
firstArcLeft = anArc.operator->();
|
firstArcLeft = anArc.get();
|
||||||
else if (aNode == SecondNode())
|
else if (aNode == SecondNode())
|
||||||
secondArcLeft = anArc.operator->();
|
secondArcLeft = anArc.get();
|
||||||
else
|
else
|
||||||
throw Standard_DomainError("MAT_Arc::SetNeighbour");
|
throw Standard_DomainError("MAT_Arc::SetNeighbour");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (aNode == FirstNode())
|
if (aNode == FirstNode())
|
||||||
firstArcRight = anArc.operator->();
|
firstArcRight = anArc.get();
|
||||||
else if (aNode == SecondNode())
|
else if (aNode == SecondNode())
|
||||||
secondArcRight = anArc.operator->();
|
secondArcRight = anArc.get();
|
||||||
else
|
else
|
||||||
throw Standard_DomainError("MAT_Arc::SetNeighbour");
|
throw Standard_DomainError("MAT_Arc::SetNeighbour");
|
||||||
}
|
}
|
||||||
|
@ -77,7 +77,7 @@ Standard_Integer MAT_BasicElt::GeomIndex() const
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
void MAT_BasicElt::SetStartArc(const Handle(MAT_Arc)& anArc)
|
void MAT_BasicElt::SetStartArc(const Handle(MAT_Arc)& anArc)
|
||||||
{
|
{
|
||||||
startLeftArc = anArc.operator->();
|
startLeftArc = anArc.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -87,7 +87,7 @@ void MAT_BasicElt::SetStartArc(const Handle(MAT_Arc)& anArc)
|
|||||||
//========================================================================
|
//========================================================================
|
||||||
void MAT_BasicElt::SetEndArc(const Handle(MAT_Arc)& anArc)
|
void MAT_BasicElt::SetEndArc(const Handle(MAT_Arc)& anArc)
|
||||||
{
|
{
|
||||||
endLeftArc = anArc.operator->();
|
endLeftArc = anArc.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
//========================================================================
|
//========================================================================
|
||||||
|
@ -33,7 +33,7 @@ MAT_Node::MAT_Node(const Standard_Integer GeomIndex,
|
|||||||
: geomIndex(GeomIndex),
|
: geomIndex(GeomIndex),
|
||||||
distance(Distance)
|
distance(Distance)
|
||||||
{
|
{
|
||||||
aLinkedArc = LinkedArc.operator->();
|
aLinkedArc = LinkedArc.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
@ -156,7 +156,7 @@ Standard_Boolean MAT_Node::Infinite() const
|
|||||||
//=============================================================================
|
//=============================================================================
|
||||||
void MAT_Node::SetLinkedArc (const Handle(MAT_Arc)& LinkedArc)
|
void MAT_Node::SetLinkedArc (const Handle(MAT_Arc)& LinkedArc)
|
||||||
{
|
{
|
||||||
aLinkedArc = LinkedArc.operator->();
|
aLinkedArc = LinkedArc.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
|
@ -378,11 +378,11 @@ void OpenGl_Group::Release (const Handle(OpenGl_Context)& theGlCtx)
|
|||||||
while (myFirst != NULL)
|
while (myFirst != NULL)
|
||||||
{
|
{
|
||||||
OpenGl_ElementNode* aNext = myFirst->next;
|
OpenGl_ElementNode* aNext = myFirst->next;
|
||||||
OpenGl_Element::Destroy (theGlCtx.operator->(), myFirst->elem);
|
OpenGl_Element::Destroy (theGlCtx.get(), myFirst->elem);
|
||||||
delete myFirst;
|
delete myFirst;
|
||||||
myFirst = aNext;
|
myFirst = aNext;
|
||||||
}
|
}
|
||||||
myLast = NULL;
|
myLast = NULL;
|
||||||
|
|
||||||
OpenGl_Element::Destroy (theGlCtx.operator->(), myAspects);
|
OpenGl_Element::Destroy (theGlCtx.get(), myAspects);
|
||||||
}
|
}
|
||||||
|
@ -1104,7 +1104,7 @@ void OpenGl_PrimitiveArray::InitBuffers (const Handle(OpenGl_Context)& th
|
|||||||
const Handle(Graphic3d_BoundBuffer)& theBounds)
|
const Handle(Graphic3d_BoundBuffer)& theBounds)
|
||||||
{
|
{
|
||||||
// Release old graphic resources
|
// Release old graphic resources
|
||||||
Release (theContext.operator->());
|
Release (theContext.get());
|
||||||
|
|
||||||
myIndices = theIndices;
|
myIndices = theIndices;
|
||||||
myAttribs = theAttribs;
|
myAttribs = theAttribs;
|
||||||
|
@ -130,44 +130,47 @@ OpenGl_View::~OpenGl_View()
|
|||||||
// =======================================================================
|
// =======================================================================
|
||||||
void OpenGl_View::ReleaseGlResources (const Handle(OpenGl_Context)& theCtx)
|
void OpenGl_View::ReleaseGlResources (const Handle(OpenGl_Context)& theCtx)
|
||||||
{
|
{
|
||||||
myGraduatedTrihedron.Release (theCtx.operator->());
|
myGraduatedTrihedron.Release (theCtx.get());
|
||||||
myFrameStatsPrs.Release (theCtx.operator->());
|
myFrameStatsPrs.Release (theCtx.get());
|
||||||
|
|
||||||
if (!myTextureEnv.IsNull())
|
if (!myTextureEnv.IsNull())
|
||||||
|
{
|
||||||
|
if (!theCtx.IsNull())
|
||||||
{
|
{
|
||||||
for (OpenGl_TextureSet::Iterator aTextureIter (myTextureEnv); aTextureIter.More(); aTextureIter.Next())
|
for (OpenGl_TextureSet::Iterator aTextureIter (myTextureEnv); aTextureIter.More(); aTextureIter.Next())
|
||||||
{
|
{
|
||||||
theCtx->DelayedRelease (aTextureIter.ChangeValue());
|
theCtx->DelayedRelease (aTextureIter.ChangeValue());
|
||||||
aTextureIter.ChangeValue().Nullify();
|
aTextureIter.ChangeValue().Nullify();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
myTextureEnv.Nullify();
|
myTextureEnv.Nullify();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (myTextureParams != NULL)
|
if (myTextureParams != NULL)
|
||||||
{
|
{
|
||||||
myTextureParams->Release (theCtx.operator->());
|
myTextureParams->Release (theCtx.get());
|
||||||
}
|
}
|
||||||
if (myBgGradientArray != NULL)
|
if (myBgGradientArray != NULL)
|
||||||
{
|
{
|
||||||
myBgGradientArray->Release (theCtx.operator->());
|
myBgGradientArray->Release (theCtx.get());
|
||||||
}
|
}
|
||||||
if (myBgTextureArray != NULL)
|
if (myBgTextureArray != NULL)
|
||||||
{
|
{
|
||||||
myBgTextureArray->Release (theCtx.operator->());
|
myBgTextureArray->Release (theCtx.get());
|
||||||
}
|
}
|
||||||
|
|
||||||
myMainSceneFbos[0] ->Release (theCtx.operator->());
|
myMainSceneFbos[0] ->Release (theCtx.get());
|
||||||
myMainSceneFbos[1] ->Release (theCtx.operator->());
|
myMainSceneFbos[1] ->Release (theCtx.get());
|
||||||
myMainSceneFbosOit[0] ->Release (theCtx.operator->());
|
myMainSceneFbosOit[0] ->Release (theCtx.get());
|
||||||
myMainSceneFbosOit[1] ->Release (theCtx.operator->());
|
myMainSceneFbosOit[1] ->Release (theCtx.get());
|
||||||
myImmediateSceneFbos[0] ->Release (theCtx.operator->());
|
myImmediateSceneFbos[0] ->Release (theCtx.get());
|
||||||
myImmediateSceneFbos[1] ->Release (theCtx.operator->());
|
myImmediateSceneFbos[1] ->Release (theCtx.get());
|
||||||
myImmediateSceneFbosOit[0]->Release (theCtx.operator->());
|
myImmediateSceneFbosOit[0]->Release (theCtx.get());
|
||||||
myImmediateSceneFbosOit[1]->Release (theCtx.operator->());
|
myImmediateSceneFbosOit[1]->Release (theCtx.get());
|
||||||
myOpenGlFBO ->Release (theCtx.operator->());
|
myOpenGlFBO ->Release (theCtx.get());
|
||||||
myOpenGlFBO2 ->Release (theCtx.operator->());
|
myOpenGlFBO2 ->Release (theCtx.get());
|
||||||
myFullScreenQuad .Release (theCtx.operator->());
|
myFullScreenQuad .Release (theCtx.get());
|
||||||
myFullScreenQuadFlip .Release (theCtx.operator->());
|
myFullScreenQuadFlip .Release (theCtx.get());
|
||||||
|
|
||||||
releaseRaytraceResources (theCtx);
|
releaseRaytraceResources (theCtx);
|
||||||
}
|
}
|
||||||
|
@ -1797,7 +1797,7 @@ inline void nullifyResource (const Handle(OpenGl_Context)& theGlContext, Handle(
|
|||||||
{
|
{
|
||||||
if (!theResource.IsNull())
|
if (!theResource.IsNull())
|
||||||
{
|
{
|
||||||
theResource->Release (theGlContext.operator->());
|
theResource->Release (theGlContext.get());
|
||||||
theResource.Nullify();
|
theResource.Nullify();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1818,10 +1818,10 @@ void OpenGl_View::releaseRaytraceResources (const Handle(OpenGl_Context)& theGlC
|
|||||||
|
|
||||||
if (!theToRebuild) // complete release
|
if (!theToRebuild) // complete release
|
||||||
{
|
{
|
||||||
myRaytraceFBO1[0]->Release (theGlContext.operator->());
|
myRaytraceFBO1[0]->Release (theGlContext.get());
|
||||||
myRaytraceFBO1[1]->Release (theGlContext.operator->());
|
myRaytraceFBO1[1]->Release (theGlContext.get());
|
||||||
myRaytraceFBO2[0]->Release (theGlContext.operator->());
|
myRaytraceFBO2[0]->Release (theGlContext.get());
|
||||||
myRaytraceFBO2[1]->Release (theGlContext.operator->());
|
myRaytraceFBO2[1]->Release (theGlContext.get());
|
||||||
|
|
||||||
nullifyResource (theGlContext, myRaytraceOutputTexture[0]);
|
nullifyResource (theGlContext, myRaytraceOutputTexture[0]);
|
||||||
nullifyResource (theGlContext, myRaytraceOutputTexture[1]);
|
nullifyResource (theGlContext, myRaytraceOutputTexture[1]);
|
||||||
@ -1850,7 +1850,7 @@ void OpenGl_View::releaseRaytraceResources (const Handle(OpenGl_Context)& theGlC
|
|||||||
|
|
||||||
if (myRaytraceScreenQuad.IsValid ())
|
if (myRaytraceScreenQuad.IsValid ())
|
||||||
{
|
{
|
||||||
myRaytraceScreenQuad.Release (theGlContext.operator->());
|
myRaytraceScreenQuad.Release (theGlContext.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,7 @@ void OpenGl_View::Redraw()
|
|||||||
// fetch OpenGl context state
|
// fetch OpenGl context state
|
||||||
aCtx->FetchState();
|
aCtx->FetchState();
|
||||||
|
|
||||||
OpenGl_FrameBuffer* aFrameBuffer = myFBO.operator->();
|
OpenGl_FrameBuffer* aFrameBuffer = myFBO.get();
|
||||||
bool toSwap = aCtx->IsRender()
|
bool toSwap = aCtx->IsRender()
|
||||||
&& !aCtx->caps->buffersNoSwap
|
&& !aCtx->caps->buffersNoSwap
|
||||||
&& aFrameBuffer == NULL;
|
&& aFrameBuffer == NULL;
|
||||||
@ -600,7 +600,7 @@ void OpenGl_View::RedrawImmediate()
|
|||||||
|
|
||||||
const Graphic3d_StereoMode aStereoMode = myRenderParams.StereoMode;
|
const Graphic3d_StereoMode aStereoMode = myRenderParams.StereoMode;
|
||||||
Graphic3d_Camera::Projection aProjectType = myCamera->ProjectionType();
|
Graphic3d_Camera::Projection aProjectType = myCamera->ProjectionType();
|
||||||
OpenGl_FrameBuffer* aFrameBuffer = myFBO.operator->();
|
OpenGl_FrameBuffer* aFrameBuffer = myFBO.get();
|
||||||
aCtx->FrameStats()->FrameStart (myWorkspace->View(), true);
|
aCtx->FrameStats()->FrameStart (myWorkspace->View(), true);
|
||||||
|
|
||||||
if ( aFrameBuffer == NULL
|
if ( aFrameBuffer == NULL
|
||||||
|
@ -1406,8 +1406,7 @@ Standard_Boolean STEPCAFControl_Reader::ReadLayers(const Handle(XSControl_WorkSe
|
|||||||
#endif
|
#endif
|
||||||
//TDF_Label InvLayerLab = LTool->FindLayer(aLayerName);
|
//TDF_Label InvLayerLab = LTool->FindLayer(aLayerName);
|
||||||
TDF_Label InvLayerLab = LTool->AddLayer(aLayerName); //skl for OCC3926
|
TDF_Label InvLayerLab = LTool->AddLayer(aLayerName); //skl for OCC3926
|
||||||
Handle(TDataStd_UAttribute) aUAttr;
|
TDataStd_UAttribute::Set (InvLayerLab, XCAFDoc::InvisibleGUID());
|
||||||
aUAttr->Set(InvLayerLab, XCAFDoc::InvisibleGUID());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Standard_True;
|
return Standard_True;
|
||||||
|
@ -177,7 +177,7 @@ void Storage_BucketOfPersistent::Append(const Handle(Standard_Persistent)& sp)
|
|||||||
|
|
||||||
if (myCurrentBucket->myCurrentSpace != myBucketSize) {
|
if (myCurrentBucket->myCurrentSpace != myBucketSize) {
|
||||||
myLength++;
|
myLength++;
|
||||||
myCurrentBucket->mySpace[myCurrentBucket->myCurrentSpace] = sp.operator->();
|
myCurrentBucket->mySpace[myCurrentBucket->myCurrentSpace] = sp.get();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -195,7 +195,7 @@ void Storage_BucketOfPersistent::Append(const Handle(Standard_Persistent)& sp)
|
|||||||
myCurrentBucket = myBuckets[myCurrentBucketNumber];
|
myCurrentBucket = myBuckets[myCurrentBucketNumber];
|
||||||
myCurrentBucket->myCurrentSpace++;
|
myCurrentBucket->myCurrentSpace++;
|
||||||
myLength++;
|
myLength++;
|
||||||
myCurrentBucket->mySpace[myCurrentBucket->myCurrentSpace] = sp.operator->();
|
myCurrentBucket->mySpace[myCurrentBucket->myCurrentSpace] = sp.get();
|
||||||
}
|
}
|
||||||
|
|
||||||
//=======================================================================
|
//=======================================================================
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
Standard_Integer TopoDS_Shape::HashCode(const Standard_Integer Upper) const
|
Standard_Integer TopoDS_Shape::HashCode(const Standard_Integer Upper) const
|
||||||
{
|
{
|
||||||
//PKV
|
//PKV
|
||||||
const Standard_Integer aI = (Standard_Integer) ptrdiff_t(myTShape.operator->());
|
const Standard_Integer aI = (Standard_Integer) ptrdiff_t(myTShape.get());
|
||||||
const Standard_Integer aHS = ::HashCode(aI,Upper);
|
const Standard_Integer aHS = ::HashCode(aI,Upper);
|
||||||
const Standard_Integer aHL = myLocation.HashCode(Upper);
|
const Standard_Integer aHL = myLocation.HashCode(Upper);
|
||||||
return (aHS^aHL)%Upper;
|
return (aHS^aHL)%Upper;
|
||||||
|
@ -553,7 +553,7 @@ void XCAFDoc_ColorTool::SetVisibility (const TDF_Label& L,
|
|||||||
Handle(XCAFDoc_GraphNode) aSHUO;
|
Handle(XCAFDoc_GraphNode) aSHUO;
|
||||||
if (ShapeTool()->IsShape(L) || ShapeTool()->GetSHUO( L, aSHUO ) )
|
if (ShapeTool()->IsShape(L) || ShapeTool()->GetSHUO( L, aSHUO ) )
|
||||||
if (!L.FindAttribute(XCAFDoc::InvisibleGUID(), aUAttr))
|
if (!L.FindAttribute(XCAFDoc::InvisibleGUID(), aUAttr))
|
||||||
aUAttr->Set( L, XCAFDoc::InvisibleGUID() );
|
TDataStd_UAttribute::Set( L, XCAFDoc::InvisibleGUID() );
|
||||||
}
|
}
|
||||||
else L.ForgetAttribute( XCAFDoc::InvisibleGUID() );
|
else L.ForgetAttribute( XCAFDoc::InvisibleGUID() );
|
||||||
}
|
}
|
||||||
@ -582,7 +582,7 @@ void XCAFDoc_ColorTool::SetColorByLayer (const TDF_Label& L,
|
|||||||
Handle(XCAFDoc_GraphNode) aSHUO;
|
Handle(XCAFDoc_GraphNode) aSHUO;
|
||||||
if (ShapeTool()->IsShape(L) || ShapeTool()->GetSHUO( L, aSHUO ) )
|
if (ShapeTool()->IsShape(L) || ShapeTool()->GetSHUO( L, aSHUO ) )
|
||||||
if (!L.FindAttribute(XCAFDoc::ColorByLayerGUID(), aUAttr))
|
if (!L.FindAttribute(XCAFDoc::ColorByLayerGUID(), aUAttr))
|
||||||
aUAttr->Set( L, XCAFDoc::ColorByLayerGUID() );
|
TDataStd_UAttribute::Set( L, XCAFDoc::ColorByLayerGUID() );
|
||||||
}
|
}
|
||||||
else L.ForgetAttribute( XCAFDoc::ColorByLayerGUID() );
|
else L.ForgetAttribute( XCAFDoc::ColorByLayerGUID() );
|
||||||
}
|
}
|
||||||
|
@ -432,7 +432,7 @@ void XCAFDoc_LayerTool::SetVisibility (const TDF_Label& layerL,
|
|||||||
Handle(TDataStd_UAttribute) aUAttr;
|
Handle(TDataStd_UAttribute) aUAttr;
|
||||||
if (! isvisible ) {
|
if (! isvisible ) {
|
||||||
if (!layerL.FindAttribute(XCAFDoc::InvisibleGUID(), aUAttr)) {
|
if (!layerL.FindAttribute(XCAFDoc::InvisibleGUID(), aUAttr)) {
|
||||||
aUAttr->Set( layerL, XCAFDoc::InvisibleGUID() );
|
TDataStd_UAttribute::Set( layerL, XCAFDoc::InvisibleGUID() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else layerL.ForgetAttribute( XCAFDoc::InvisibleGUID() );
|
else layerL.ForgetAttribute( XCAFDoc::InvisibleGUID() );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user