MantisBT
Mantis Bug Tracker Workflow

View Issue Details Jump to Notes ] Related Changesets ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0026832Community[OCCT] OCCT:Application Frameworkpublic2015-11-02 16:292016-12-09 16:37
ReporterVico Liang 
Assigned Tobugmaster 
PrioritynormalSeveritymajor 
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version[OCCT] 6.9.1 
Target Version[OCCT] 7.1.0Fixed in Version[OCCT] 7.1.0 
Summary0026832: TFunction_Iterator won't work if ExecutionStatus is Standard_False.
DescriptionThere are several functions created, but the loop of below will never be entered. "iterator.More()" always returns false.

for(TFunction_Iterator iterator(aLabel); iterator.More(); iterator.Next())
{
    // This loop never entered
}

if change the usage as below, it will work:

TFunction_Iterator iterator;
iterator.SetUsageOfExecutionStatus(Standard_True);
for(iterator.Init(aLabel); iterator.More(); iterator.Next())
{
   // Works well
}
Steps To ReproduceDear Szy, could you please review the modification: CR26832.
TagsNo tags attached.
Test case numberNot needed
Attached Files

- Relationships

-  Notes
(0047725)
Vico Liang (developer)
2015-11-02 16:51

The simplest way to reproduce this bug is to create just one function and iterate the function with TFunction_Iterator.
(0049671)
szy (administrator)
2015-12-29 17:39

Could you check it.
(0050557)
vro (developer)
2016-02-10 10:07

It seems it is not truth... the method More() of the function iterator returns true while the graph of functions is not iterated completely. If the execution status is used, it takes into account the status of the function and iterates only through not executed yet functions. Otherwise, it iterates the whole graph of functions.
You may look at a sample here : http://tracker.dev.opencascade.org/view.php?id=24665. [^] Insert your iteration code at the end of createDefaultModel1() or createDefaultModel2() methods of MainWindow.cpp and check how it behaves. Any questions are welcome!
(0050636)
Vico Liang (developer)
2016-02-11 14:41

Dear vro,

The sample is different about the iterator usage. The bug just occurs in for loop form, it works well if using like below, i'm sure it will be reproducible use in for loop.

    while (!fIterator.Current().IsEmpty())
    {
        const TDF_LabelList& funcs = fIterator.Current();
        if (funcs.Extent() > nbx)
            nbx = funcs.Extent();
        nby++;
        fIterator.Next();
    }
(0050637)
Vico Liang (developer)
2016-02-11 14:41

for(TFunction_Iterator iterator(aLabel); iterator.More(); iterator.Next())
 {
     // This loop never entered
 }
(0050639)
vro (developer)
2016-02-11 14:49

So, if there is no bugs, we may close the issue, I suppose. Any proposals for improvement of the code are welcome!
(0050642)
Vico Liang (developer)
2016-02-11 15:24

Dear vro,

Below for look desn't work as my previous stated. This does not align with OCCT methodnology. OCCT iterator might work in style as below:

for(TFunction_Iterator iterator(aLabel); iterator.More(); iterator.Next())
  {
      // This loop never entered
  }

Actually, there is a bug, but the sample escape it. For a normal user, there should be no way to make it work.
(0050643)
Vico Liang (developer)
2016-02-11 15:27

I propose to implement the TFunction_Iterator::More() by just returning {!fIterator.Current().IsEmpty()} if it doesn't consider the executing status.
(0050644)
vro (developer)
2016-02-11 15:33

If you add your code-snippet to the sample application and run it in debug mode, you would see that the iterator perfectly works in spite of the execution status.
I don't see any reason to change the method More() of the iterator. It works as expected. And it works fine. Did you check it in the sample application?
(0050646)
Vico Liang (developer)
2016-02-11 15:42

Dear vro,

please check your implementation as below, if there is just one function, the last line "myPassedFunctions.Extent() < myScope->GetFunctions().Extent();" should never be true, becasue there are equal.


Standard_Boolean TFunction_Iterator::More() const
{
  if (myUsageOfExecutionStatus)
  {
    TFunction_DoubleMapIteratorOfDoubleMapOfIntegerLabel itrm(myScope->GetFunctions());
    for (; itrm.More(); itrm.Next())
    {
      const TDF_Label& L = itrm.Key2();
      if (GetStatus(L) == TFunction_ES_NotExecuted)
    return Standard_True;
    }
    return Standard_False;
  }
  return myPassedFunctions.Extent() < myScope->GetFunctions().Extent();
}
(0050663)
vro (developer)
2016-02-12 09:07

Hello Vico! Many thanks! Now I see the bug. Indeed, for the case of one function the iterator doesn't return it. I will fix it, thanks again!
(0051000)
git (administrator)
2016-02-19 12:22

Branch CR26832 has been created by vro.

SHA-1: e541ae0577022b6107545b3127938ceb7200bf3d


Detailed log of new commits:

Author: vro
Date: Fri Feb 19 12:21:43 2016 +0300

    0026832: TFunction_Iterator won't work if ExecutionStatus is Standard_False.
    The method TFunction_Iterator::More() is corrected().
(0051001)
vro (developer)
2016-02-19 12:24

There is no test-case or a draw-command. Testing is possible only through a new FuncDemo application.
(0051867)
szy (administrator)
2016-03-23 10:50

Reviewed.
(0051874)
git (administrator)
2016-03-23 12:38

Branch CR26832 has been updated forcibly by apv.

SHA-1: f4d5f9f4d1c43c0a12e6d4c7fec9ccf5e5dc9b81
(0051875)
apv (tester)
2016-03-23 12:39

Branch CR26832 has been rebased on the current master
(0051934)
apv (tester)
2016-03-24 11:46

Dear BugMaster,

Branch CR26832 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested.
SHA-1: f4d5f9f4d1c43c0a12e6d4c7fec9ccf5e5dc9b81

Number of compiler warnings:
occt component:
   Linux: 0 (0 on master)
   Windows: 0 (0 on master)
   MacOS: 0 (0 on master)
products component:
   Linux: 68
   Windows: 0
   MacOS: 1133

Regressions/Differences:
Not detected

Testing cases:
Not needed

Testing on Linux:
Total MEMORY difference: 89390901 / 90308255 [-1.02%]
Total CPU difference: 19330.12000000004 / 19527.04000000009 [-1.01%]

Testing on Windows:
Total MEMORY difference: 57456303 / 57486237 [-0.05%]
Total CPU difference: 17932.82975329875 / 17687.752182298846 [+1.39%]
(0052890)
git (administrator)
2016-04-17 13:40

Branch CR26832 has been deleted by kgv.

SHA-1: f4d5f9f4d1c43c0a12e6d4c7fec9ccf5e5dc9b81

- Related Changesets
occt: master 965681c5
Timestamp: 2016-02-19 09:21:43
Author: vro
Committer: bugmaster
Details ] Diff ]
0026832: TFunction_Iterator won't work if ExecutionStatus is Standard_False.
The method TFunction_Iterator::More() is corrected().
mod - src/TFunction/TFunction_Iterator.cxx Diff ] File ]

- Issue History
Date Modified Username Field Change
2015-11-02 16:29 Vico Liang New Issue
2015-11-02 16:29 Vico Liang Assigned To => szy
2015-11-02 16:51 Vico Liang Note Added: 0047725
2015-12-18 11:50 abv Target Version 7.0.0 => 7.1.0
2015-12-29 17:39 szy Note Added: 0049671
2015-12-29 17:39 szy Assigned To szy => vro
2015-12-29 17:39 szy Status new => assigned
2016-02-10 10:07 vro Note Added: 0050557
2016-02-10 10:07 vro Assigned To vro => Vico Liang
2016-02-10 10:07 vro Status assigned => feedback
2016-02-11 14:41 Vico Liang Note Added: 0050636
2016-02-11 14:41 Vico Liang Note Added: 0050637
2016-02-11 14:42 Vico Liang Assigned To Vico Liang => vro
2016-02-11 14:43 Vico Liang Status feedback => assigned
2016-02-11 14:49 vro Note Added: 0050639
2016-02-11 15:24 Vico Liang Note Added: 0050642
2016-02-11 15:27 Vico Liang Note Added: 0050643
2016-02-11 15:33 vro Note Added: 0050644
2016-02-11 15:42 Vico Liang Note Added: 0050646
2016-02-12 09:07 vro Note Added: 0050663
2016-02-19 12:22 git Note Added: 0051000
2016-02-19 12:24 vro Note Added: 0051001
2016-02-19 12:24 vro Assigned To vro => szy
2016-02-19 12:24 vro Status assigned => resolved
2016-02-19 12:24 vro Steps to Reproduce Updated View Revisions
2016-03-23 10:50 szy Note Added: 0051867
2016-03-23 10:50 szy Assigned To szy => bugmaster
2016-03-23 10:50 szy Status resolved => reviewed
2016-03-23 11:12 apv Assigned To bugmaster => apv
2016-03-23 12:38 git Note Added: 0051874
2016-03-23 12:39 apv Note Added: 0051875
2016-03-24 10:52 apv Test case number => Not needed
2016-03-24 11:46 apv Note Added: 0051934
2016-03-24 11:46 apv Assigned To apv => bugmaster
2016-03-24 11:46 apv Status reviewed => tested
2016-04-08 11:55 bugmaster Changeset attached => occt master 965681c5
2016-04-08 11:55 bugmaster Status tested => verified
2016-04-08 11:55 bugmaster Resolution open => fixed
2016-04-17 13:40 git Note Added: 0052890
2016-12-09 16:33 user533 Status verified => closed
2016-12-09 16:37 user533 Fixed in Version => 7.1.0


Copyright © 2000 - 2018 MantisBT Team
Powered by Mantis Bugtracker