MantisBT - Open CASCADE
View Issue Details
0029142Open CASCADE[OCCT] OCCT:Application Frameworkpublic2017-09-25 17:412018-06-29 21:19
dbv 
bugmaster 
normalminor 
closedfixed 
 
[OCCT] 7.3.0[OCCT] 7.3.0 
bugs caf bug29142
0029142: Exception on Redo
Problem described in issue 0028946 is not actually fixed. Now it reproduces on Redo. This is due to the fact that deltas are applied in the order of attributes on the label, and not in the order of their real change.
static Standard_Integer TestRedo (Draw_Interpretor& theDI,
                                  Standard_Integer theArgC,
                                  const char** theArgV)
{
  Handle (TDocStd_Application) anApp = DDocStd::GetApplication ();
  Handle (TDocStd_Document) aDoc;
  anApp->NewDocument ("BinOcaf", aDoc);

  TDataStd_Integer::Set (aDoc->Main (), 1);
  TDataStd_Real::Set (aDoc->Main (), 1);

  aDoc->SetUndoLimit (1);
  aDoc->OpenCommand ();

  aDoc->Main ().ForgetAttribute (TDataStd_Integer::GetID ());
  TDataStd_Integer::Set (aDoc->Main (), 1);

  aDoc->CommitCommand ();

  aDoc->Undo ();
  aDoc->Redo ();

  return 0;
}


Test => ..\tests\bugs\caf\bug29142
No tags attached.
related to 0028946closed bugmaster Open CASCADE Exception on Undo 
related to 0029116verified bugmaster Community [Regression] OCAF attributes insertion order is violated again 
related to 0029531closed bugmaster Open CASCADE Application Framework - Exception on Redo 
related to 0029884new mpv Community Calling sequence of BeforeUndo() and AfterUndo() unpredictable 
Issue History
2017-09-25 17:41dbvNew Issue
2017-09-25 17:41dbvAssigned To => mpv
2017-09-25 17:41dbvRelationship addedrelated to 0028946
2017-09-25 17:42dbvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=17720#r17720
2017-10-03 14:39mpvAssigned Tompv => vro
2017-10-03 14:41mpvNote Added: 0071153
2017-10-03 14:41mpvStatusnew => assigned
2017-10-03 14:45mpvRelationship addedrelated to 0029116
2017-10-12 15:53gitNote Added: 0071372
2017-10-12 16:07szyNote Added: 0071375
2017-10-12 16:07szyAssigned Tovro => mpv
2017-10-12 16:07szyStatusassigned => resolved
2017-10-12 17:06gitNote Added: 0071379
2017-10-16 09:23mpvNote Added: 0071509
2017-10-16 09:23mpvAssigned Tompv => szy
2017-10-16 09:23mpvStatusresolved => assigned
2017-11-15 17:39gitNote Added: 0072259
2017-11-15 17:44szyNote Added: 0072261
2017-11-15 17:44szyAssigned Toszy => mpv
2017-11-15 17:44szyStatusassigned => resolved
2017-11-15 17:44szySteps to Reproduce Updatedbug_revision_view_page.php?rev_id=18154#r18154
2017-11-16 16:17mpvAssigned Tompv => vro
2017-11-17 09:31vroNote Added: 0072307
2017-11-17 09:31vroAssigned Tovro => mpv
2017-11-17 09:31vroStatusresolved => reviewed
2017-11-17 09:39mpvNote Added: 0072309
2017-11-17 10:18szyNote Added: 0072311
2017-11-20 16:25szyNote Added: 0072337
2017-11-20 16:34szyAssigned Tompv => bugmaster
2017-11-20 17:20gitNote Added: 0072340
2017-11-20 17:31gitNote Added: 0072341
2017-11-21 10:08szyNote Added: 0072355
2017-11-21 11:54bugmasterTest case number => bugs caf bug29142
2017-11-21 11:57bugmasterNote Added: 0072358
2017-11-21 11:57bugmasterStatusreviewed => tested
2017-11-21 11:58bugmasterNote Edited: 0072358bug_revision_view_page.php?bugnote_id=72358#r18197
2017-11-23 12:15gitNote Added: 0072431
2017-11-25 12:28bugmasterChangeset attached => occt master a7378539
2017-11-25 12:28bugmasterStatustested => verified
2017-11-25 12:28bugmasterResolutionopen => fixed
2017-12-07 21:07gitNote Added: 0072793
2017-12-07 21:07gitNote Added: 0072794
2017-12-07 21:07gitNote Added: 0072795
2018-02-20 12:58aivTarget Version7.4.0 => 7.3.0
2018-03-01 15:02dbvRelationship addedrelated to 0029531
2018-06-20 11:08Vico LiangRelationship addedrelated to 0029884
2018-06-29 21:13aivFixed in Version => 7.3.0
2018-06-29 21:19aivStatusverified => closed

Notes
(0071153)
mpv   
2017-10-03 14:41   
So, here the any order of attributes could not help. It is proposed to process removed attributes (which will be created) after all other deltas processing.
(0071372)
git   
2017-10-12 15:53   
Branch CR29142 has been created by szy.

SHA-1: 6b2c520f808bd38ec5b37291b91aa1ec03952b79


Detailed log of new commits:

Author: szy
Date: Thu Oct 12 15:53:27 2017 +0300

    0029142: Exception on Redo.
    
    //Forgotten attribute status is taken into account.

Author: szy
Date: Thu Oct 12 15:43:08 2017 +0300

    Merge branch 'master' of git.dev.opencascade.org:occt

Author: szy
Date: Tue Oct 3 16:23:37 2017 +0300

    Merge branch 'master' of git.dev.opencascade.org:occt

Author: szy
Date: Thu Sep 28 18:19:56 2017 +0300

    Merge branch 'master' of git.dev.opencascade.org:occt
(0071375)
szy   
2017-10-12 16:07   
The issue is fixed by taken into account 'forgotten' status of the attribute.
Review it, please. After I will check it with Jenkins.
(0071379)
git   
2017-10-12 17:06   
Branch CR29142 has been updated by szy.

SHA-1: 22c7d0a5f3252f7f183ffba592e70f4e961ba358


Detailed log of new commits:

Author: szy
Date: Thu Oct 12 17:06:40 2017 +0300

    0029142: Exception on Redo.
    
    //test case bugs/caf/bug29142.

(0071509)
mpv   
2017-10-16 09:23   
With this fix the following code throws no exception.

pload ALL
NewDocument D BinOcaf
UndoLimit D 100
set Lab1 [Label D 0:1:1]
NewCommand D
SetInteger D $Lab1 111
NewCommand D
ForgetAll D $Lab1
CommitCommand D
SetInteger D $Lab1 222
Undo D

However the "master" version does not allow having two attributes on one label.
(0072259)
git   
2017-11-15 17:39   
Branch CR29142_1 has been created by szy.

SHA-1: e0faeec217ab9454f5273bbc4d9d65197cd75314


Detailed log of new commits:

Author: szy
Date: Wed Nov 15 17:38:48 2017 +0300

    0029142: Exception on Redo.
    
    //Order of attributes deltas is fixed.

Author: szy
Date: Tue Nov 14 16:54:26 2017 +0300

    Merge branch 'master' of git.dev.opencascade.org:occt

Author: szy
Date: Fri Oct 13 14:23:55 2017 +0300

    Merge branch 'master' of git.dev.opencascade.org:occt
(0072261)
szy   
2017-11-15 17:44   
The previous solution is changed to reordering of AttributesDeltas inside Delta.
Review it, please.
In addition to this I can propose an alternative solution too.
(0072307)
vro   
2017-11-17 09:31   
The fix fixes the problem!
Also, your idea to introduce a flag forbidding developers to delete and create the same attribute within one transaction seems reasonable too.
In addition, seems useful to introduce a flag in TDF_Attribute, which allows the attribute to participate in transaction mechanism or not. By default, all attributes participate in undo/redo (no change for default behavior). But some special user-defined attributes might ignore the transactions... this flag might be very useful for such attributes, what do you think?
(0072309)
mpv   
2017-11-17 09:39   
About the flag to forbid delete and add attribute in one transaction: in complicated applications this may block development because different independent (and external, like XCAF) components may work one the same labels consequently in one transaction. Involving this flag only because of complexity of implementation in OCAF will casue searching workarounds for this limitation.

Participation in transactions flag - I agree, this may be a good idea. Especially if this flag may be defined outside of the attribute (without needs of redefinition of attribute).
(0072311)
szy   
2017-11-17 10:18   
I prefer to present the idea face to face to avoid useless writing.
Let's meet next week and discuss the idea.
(0072337)
szy   
2017-11-20 16:25   
Tested - http://jenkins-test-10.nnov.opencascade.com/view/CR29142-master/. [^]
(0072340)
git   
2017-11-20 17:20   
Branch CR29142_1 has been updated by szy.

SHA-1: 13dab595d386e5a3ceadbf574d1f9454c6c6429c


Detailed log of new commits:

Author: szy
Date: Mon Nov 20 17:20:32 2017 +0300

    0029142: Exception on Redo.
    
    //Removing extra qualifier

Author: szy
Date: Mon Nov 20 17:07:12 2017 +0300

    Merge branch 'CR29142_1' of git.dev.opencascade.org:occt into CR29142_1

Author: szy
Date: Wed Nov 15 17:38:48 2017 +0300

    0029142: Exception on Redo.
    
    //Order of attributes deltas is fixed.

Author: szy
Date: Mon Nov 20 16:29:04 2017 +0300

    Merge branch 'master' of git.dev.opencascade.org:occt

(0072341)
git   
2017-11-20 17:31   
Branch CR29142_2 has been created by szy.

SHA-1: 459f0a36d6739a44b50b3bdf800f5668443d84dd


Detailed log of new commits:

Author: szy
Date: Mon Nov 20 17:31:15 2017 +0300

    0029142: Exception on Redo.
    
    ////Order of attributes deltas is fixed.
(0072355)
szy   
2017-11-21 10:08   
Tested CR29142_2: => http://jenkins-test-10.nnov.opencascade.com/view/CR29142-master/. [^]
(0072358)
bugmaster   
2017-11-21 11:57   
(edited on: 2017-11-21 11:58)
Combination -
OCCT branch : CR29142_2 SHA-1: 459f0a36d6739a44b50b3bdf800f5668443d84dd
Products branch : master
was compiled on Linux, MacOS and Windows platforms and tested on optimize mode.

Number of compiler warnings:
No new/fixed warnings

Regressions/Differences/Improvements:
No regressions/differences

CPU differences:
Linux:
OCCT
Total CPU difference: 20586.690000000417 / 20649.13000000041 [-0.30%]
Products
Total CPU difference: 7907.560000000076 / 7869.380000000079 [+0.49%]
Windows:
OCCT
Total CPU difference: 18327.231481498555 / 18333.206319798577 [-0.03%]
Products
Total CPU difference: 7829.846191000003 / 7930.73203769996 [-1.27%]
Image differences :
No differences that require special attention

Memory differences :
No differences that require special attention

Test case is OK

(0072431)
git   
2017-11-23 12:15   
Branch CR29142_2 has been updated by szy.

SHA-1: bd7a28bd4bca3d6b71fb7e203dbf12f65701bb8a


Detailed log of new commits:

Author: szy
Date: Thu Nov 23 12:15:06 2017 +0300

    0029142: Exception on Redo.
    
    //Fix of the warning for VStudio 2017.

(0072793)
git   
2017-12-07 21:07   
Branch CR29142 has been deleted by kgv.

SHA-1: 22c7d0a5f3252f7f183ffba592e70f4e961ba358
(0072794)
git   
2017-12-07 21:07   
Branch CR29142_1 has been deleted by kgv.

SHA-1: 13dab595d386e5a3ceadbf574d1f9454c6c6429c
(0072795)
git   
2017-12-07 21:07   
Branch CR29142_2 has been deleted by kgv.

SHA-1: bd7a28bd4bca3d6b71fb7e203dbf12f65701bb8a