From 57c718c4b906bad98d5ae2f6f239ca860cab109b Mon Sep 17 00:00:00 2001 From: szy Date: Thu, 23 Apr 2015 17:28:40 +0300 Subject: [PATCH] 0026061: TNaming_Selector crash in select method. TNaming_Selector crash in select method. TNaming_Localizer is protected from not expected input arguments. Test case for issue CR26061 --- src/TNaming/TNaming_Localizer.cxx | 1 + tests/bugs/caf/bug26061 | 47 +++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 tests/bugs/caf/bug26061 diff --git a/src/TNaming/TNaming_Localizer.cxx b/src/TNaming/TNaming_Localizer.cxx index 50723686b7..94017e500f 100644 --- a/src/TNaming/TNaming_Localizer.cxx +++ b/src/TNaming/TNaming_Localizer.cxx @@ -543,6 +543,7 @@ void TNaming_Localizer::FindNeighbourg (const TopoDS_Shape& Sol, const TopoDS_Shape& S, TopTools_MapOfShape& Neighbourg) { + if(Sol.IsNull() || S.IsNull()) return; TopAbs_ShapeEnum TA = S.ShapeType(); TopAbs_ShapeEnum TS=TopAbs_COMPOUND; diff --git a/tests/bugs/caf/bug26061 b/tests/bugs/caf/bug26061 new file mode 100644 index 0000000000..5ec3b6b2e6 --- /dev/null +++ b/tests/bugs/caf/bug26061 @@ -0,0 +1,47 @@ +puts "============" +puts "OCC26061" +puts "============" +puts "" +####################################################################### +# TNaming_Selector crash in select method. +####################################################################### + +pload QAcommands + +NewDocument D MDTV-Standard + +## 1. Build Primitive face +plane pl 0 0 0 0 0 1 +mkface f0 pl -10 10 -10 10 +set Lab900 [Label D 0:1:900] +BuildNamedShape D $Lab900 P f0 + +## 2. Mirror f0 +tmirror f0 0 0 10 0 0 1 +renamevar f0 fmir +GetShape D $Lab900 f0 +set Lab901 [Label D 0:1:901] +BuildNamedShape D $Lab901 G f0 fmir + +## 3. Translate primitive face +ttranslate f0 0 0 -5 +renamevar f0 ftr5 +set Lab902 [Label D 0:1:902] +GetShape D $Lab900 f0 +BuildNamedShape D $Lab902 M f0 ftr5 + +## 4. Translate mirrored face +GetShape D $Lab901 fmir +renamevar fmir fmirtr +ttranslate fmirtr 0 0 -5 +GetShape D $Lab901 fmir +set Lab903 [Label D 0:1:903] +BuildNamedShape D $Lab903 M fmir fmirtr + +## 5. Select the face from step 4 (mirrored & translasted) +set Lab904 [Label D 0:1:904] +GetShape D $Lab903 fSel +SelectShape D $Lab904 fSel +## ==> No exception +GetShape D $Lab904 fRes +whatis fRes -- 2.20.1