-
Notifications
You must be signed in to change notification settings - Fork 129
Open
Milestone
Description
Found a bug when running the example CPP code under valgrind..
Not sure of the correct fix, but I'm fairly sure we should not delete the ptr.c when assigning a new Entity to the attribute. Something more in keeping with the neighbouring definitions?
@@ -961,10 +962,9 @@ void STEPattribute::Binary( SDAI_Binary * bin ) {
void STEPattribute::Entity( SDAI_Application_instance * ent ) {
assert( NonRefType() == ENTITY_TYPE );
- if( ptr.c ) {
- delete ptr.c;
+ if( ptr.c == NULL ) {
+ ptr.c = new (SDAI_Application_instance * );
}
- ptr.c = new (SDAI_Application_instance * );
*( ptr.c ) = ent;
}I think, given that the early bound schema create their attribute definitions to point to data within the C++ classes, it is important not to detach this association when setting attributes via the late bound APIs such as this one.
FWIW, I'm very new to STEPCODE, (and not a regular C++ developer), so please scrutinise the issue, don't take my above patch as correct... it may not be! (But it keeps Valgrind a lot happier for the shipped example code).
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels