Archived issue #0029116
[Regression] OCAF attributes insertion order is violated again
Description
7.2.0 has introduced a regression reported as #0024755 and which was fixed in 6.8.0.
The following test case failed when running under 7.2.0:
/*! Regression test for id 24755.*/
void TDF_LabelTest::AddAttribute()
{
Handle(TDocStd_Application) anApp = new AppStdL_Application;
Handle(TDocStd_Document) aDoc;
anApp->NewDocument ("MDTV-Standard", aDoc);
TDF_Label aLab = aDoc->Main();
TDataStd_Integer::Set (aLab, 0);
TDataStd_Name::Set (aLab, "test");
Standard_Boolean anIsInteger = Standard_True, anIsName = Standard_True;
#if OCC_VERSION_HEX > 0x060701
TDF_AttributeIterator i (aLab);
Handle(TDF_Attribute) anAttr = i.Value();
anIsInteger = anAttr->IsKind (STANDARD_TYPE (TDataStd_Integer));
i.Next();
anAttr = i.Value();
anIsName = anAttr->IsKind (STANDARD_TYPE (TDataStd_Name));
#endif
//defer check to after close
anApp->Close (aDoc);
QVERIFY (anIsInteger);
QVERIFY (anIsName);
}
The following test case failed when running under 7.2.0:
/*! Regression test for id 24755.*/
void TDF_LabelTest::AddAttribute()
{
Handle(TDocStd_Application) anApp = new AppStdL_Application;
Handle(TDocStd_Document) aDoc;
anApp->NewDocument ("MDTV-Standard", aDoc);
TDF_Label aLab = aDoc->Main();
TDataStd_Integer::Set (aLab, 0);
TDataStd_Name::Set (aLab, "test");
Standard_Boolean anIsInteger = Standard_True, anIsName = Standard_True;
#if OCC_VERSION_HEX > 0x060701
TDF_AttributeIterator i (aLab);
Handle(TDF_Attribute) anAttr = i.Value();
anIsInteger = anAttr->IsKind (STANDARD_TYPE (TDataStd_Integer));
i.Next();
anAttr = i.Value();
anIsName = anAttr->IsKind (STANDARD_TYPE (TDataStd_Name));
#endif
//defer check to after close
anApp->Close (aDoc);
QVERIFY (anIsInteger);
QVERIFY (anIsName);
}
Steps to reproduce
See description
Public activity
9 archived notes
Participants are labeled by their role within this record.
Fix of 24755 produced regression 28946, whis is why it was rolled-back.
"Undo" functionality is based on reversed order of attributes on the label: it adds/removes attributes in the reversed order they were removed/added.
So, this problem has the higher piority than request 24755. Also, changing "undo" algorithm will poduce loss of performance.
Anyway, developer may use the append flag of TDF_Label::AddAttribute to reproduce the needed order. But in this case he must be sure that he does not remove and then add attribute to the same label in the same transactio. Otherwise this may cause crash on "Undo".
So, this problem has the higher piority than request 24755. Also, changing "undo" algorithm will poduce loss of performance.
Anyway, developer may use the append flag of TDF_Label::AddAttribute to reproduce the needed order. But in this case he must be sure that he does not remove and then add attribute to the same label in the same transactio. Otherwise this may cause crash on "Undo".
Ok, after some discussions it is decided to think again about this problem. May be the order of attributes may be reverted during open or save of the document to keep the document's content same each time. Perhaps performance become not so bad.
Due to 29142 probably the order of appended attributes may be restored.
Branch [archived branch] has been created by Commenter 3.
[revision removed]
Detailed log of new commits:
Author: Commenter 3
Date: Mon Jun 4 10:47:18 2018 +0300
0029116: [Regression] OCAF attributes insertion order is violated again
[revision removed]
Detailed log of new commits:
Author: Commenter 3
Date: Mon Jun 4 10:47:18 2018 +0300
0029116: [Regression] OCAF attributes insertion order is violated again
Dear Sergey, could you review please?: http://jenkins-test-11.nnov.opencascade.com/view/CR29116-master-vro/view/TESTING/. There is some instability in jenkins in strtod() and reading DXF test-cases, ignore please.
Reviewed.
Combination -
OCCT branch : [archived branch] SHA - [revision removed]
Products branch : [archived branch] SHA - [revision removed]
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.
Number of compiler warnings:
No new/fixed warnings
Regressions/Differences/Improvements:
No regressions/differences
CPU differences:
Debian70-64:
OCCT
Total CPU difference: 17096.14999999993 / 17011.039999999866 [+0.50%]
Products
Total CPU difference: 7487.140000000035 / 7518.570000000041 [-0.42%]
Windows-64-VC10:
OCCT
Total CPU difference: 16816.970200398548 / 16821.806231398525 [-0.03%]
Products
Total CPU difference: 8228.771948199888 / 8176.012409999883 [+0.65%]
Image differences :
No differences that require special attention
Memory differences :
No differences that require special attention
OCCT branch : [archived branch] SHA - [revision removed]
Products branch : [archived branch] SHA - [revision removed]
was compiled on Linux, MacOS and Windows platforms and tested in optimize mode.
Number of compiler warnings:
No new/fixed warnings
Regressions/Differences/Improvements:
No regressions/differences
CPU differences:
Debian70-64:
OCCT
Total CPU difference: 17096.14999999993 / 17011.039999999866 [+0.50%]
Products
Total CPU difference: 7487.140000000035 / 7518.570000000041 [-0.42%]
Windows-64-VC10:
OCCT
Total CPU difference: 16816.970200398548 / 16821.806231398525 [-0.03%]
Products
Total CPU difference: 8228.771948199888 / 8176.012409999883 [+0.65%]
Image differences :
No differences that require special attention
Memory differences :
No differences that require special attention
Branch [archived branch] has been deleted by Participant.
[revision removed]
[revision removed]
Related records