mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-04-16 10:08:36 +03:00
0023799: Crash on copying a label
A check on NULL is added to prevent the crash. Adding test case for this fix
This commit is contained in:
parent
973191093d
commit
643cc6aae4
@ -97,10 +97,13 @@ void TDF_CopyLabel::ExternalReferences(const TDF_Label& aRefLabel, const TDF_Lab
|
|||||||
|
|
||||||
// TDF_Tool::Entry(att->Label(), entr1);
|
// TDF_Tool::Entry(att->Label(), entr1);
|
||||||
// cout<<"\t\tReferences attribute dynamic type = "<<att->DynamicType()<<" Label = "<<entr1 <<endl;
|
// cout<<"\t\tReferences attribute dynamic type = "<<att->DynamicType()<<" Label = "<<entr1 <<endl;
|
||||||
if (aFilter.IsKept(att) && att->Label().IsDifferent(aRefLabel) &&
|
if (!att.IsNull() && !att->Label().IsNull())
|
||||||
!att->Label().IsDescendant(aRefLabel)) {
|
{
|
||||||
aExternals.Add(att);
|
if (aFilter.IsKept(att) && att->Label().IsDifferent(aRefLabel) &&
|
||||||
extRefFound = Standard_True;
|
!att->Label().IsDescendant(aRefLabel)) {
|
||||||
|
aExternals.Add(att);
|
||||||
|
extRefFound = Standard_True;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,9 +181,12 @@ static Standard_Boolean TDF_Tool_DescendantRef
|
|||||||
// CLE
|
// CLE
|
||||||
// const Handle(TDF_Attribute)& att = attMItr.Key();
|
// const Handle(TDF_Attribute)& att = attMItr.Key();
|
||||||
Handle(TDF_Attribute) att = attMItr.Key();
|
Handle(TDF_Attribute) att = attMItr.Key();
|
||||||
// ENDCLE
|
if (!att.IsNull() && !att->Label().IsNull())
|
||||||
if (aFilter.IsKept(att) && !att->Label().IsDescendant(aRefLabel))
|
{
|
||||||
return Standard_False;
|
// ENDCLE
|
||||||
|
if (aFilter.IsKept(att) && !att->Label().IsDescendant(aRefLabel))
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
ds->Clear();
|
ds->Clear();
|
||||||
}
|
}
|
||||||
|
25
tests/bugs/caf/bug23799
Executable file
25
tests/bugs/caf/bug23799
Executable file
@ -0,0 +1,25 @@
|
|||||||
|
puts "============"
|
||||||
|
puts "OCC23799"
|
||||||
|
puts "============"
|
||||||
|
puts ""
|
||||||
|
#######################################################################
|
||||||
|
# Crash on copying a label
|
||||||
|
#######################################################################
|
||||||
|
|
||||||
|
set BugNumber OCC23799
|
||||||
|
|
||||||
|
# Create a new document
|
||||||
|
NewDocument D
|
||||||
|
|
||||||
|
psphere s 100
|
||||||
|
explode s f
|
||||||
|
|
||||||
|
ImportShape D 0:1 s
|
||||||
|
SelectShape D 0:2 s_1 s
|
||||||
|
ForgetAll D 0:1
|
||||||
|
|
||||||
|
if { [catch [CopyLabel D 0:2 0:3] ] != 0 } {
|
||||||
|
puts "${BugNumber}: Error copy label"
|
||||||
|
} else {
|
||||||
|
puts "${BugNumber}: OK"
|
||||||
|
}
|
@ -1,5 +1,6 @@
|
|||||||
puts "TODO ?#22623 ALL: \\*\\* Exception"
|
puts "TODO ?#22623 ALL: \\*\\* Exception"
|
||||||
puts "TODO ?#22623 ALL: An exception was caught"
|
puts "TODO ?#22623 ALL: An exception was caught"
|
||||||
|
puts "TODO ?#22623 ALL: TEST INCOMPLETE"
|
||||||
|
|
||||||
puts "============"
|
puts "============"
|
||||||
puts "OCC22623"
|
puts "OCC22623"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user