Skip to content

Commit 4129d36

Browse files
committed
add stepcore test for segfault in STEPattribute::set_null()
1 parent 619c927 commit 4129d36

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

src/clstepcore/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ endfunction(add_stepcore_test name libs)
2424
add_stepcore_test("SupertypesIterator" "stepcore;steputils;stepeditor;stepdai;base") #all these libs are necessary?
2525
add_stepcore_test("operators_STEPattribute" "stepcore;steputils;stepeditor;stepdai;base")
2626
add_stepcore_test("operators_SDAI_Select" "stepcore;steputils;stepeditor;stepdai;base")
27+
add_stepcore_test("null_attr" "stepcore;steputils;stepeditor;stepdai;base")
2728

2829
# Local Variables:
2930
# tab-width: 8
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#include <ExpDict.h>
2+
#include <STEPattribute.h>
3+
#include <sdaiString.h>
4+
5+
AttrDescriptor *ad = 0;
6+
EntityDescriptor *ed = 0;
7+
TypeDescriptor *td;
8+
Schema *sch = 0;
9+
10+
int main () {
11+
SDAI_String _description;
12+
sch = new Schema( "Ifc2x3" );
13+
td = new TypeDescriptor( "Ifctext", sdaiSTRING, sch, "STRING" );
14+
ed = new EntityDescriptor( "Ifcroot", sch, LTrue, LFalse );
15+
ad = new AttrDescriptor( "description", td, LTrue, LFalse, AttrType_Explicit, *ed );
16+
ed->AddExplicitAttr( ad );
17+
STEPattribute *a = new STEPattribute(*ad, &_description);
18+
a -> set_null();
19+
delete a;
20+
//delete ad; //this is deleted in EntityDescriptor dtor
21+
delete ed;
22+
delete td;
23+
delete sch;
24+
}

test/cpp/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,3 @@ add_subdirectory(schema_specific)
1010
# indent-tabs-mode: t
1111
# End:
1212
# ex: shiftwidth=2 tabstop=8
13-

0 commit comments

Comments
 (0)