View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0026832 | Community | OCCT:Application Framework | public | 2015-11-02 16:29 | 2016-12-09 16:37 |
Reporter | Vico Liang | Assigned To | bugmaster | ||
Priority | normal | Severity | major | ||
Status | closed | Resolution | fixed | ||
Product Version | 6.9.1 | ||||
Target Version | 7.1.0 | Fixed in Version | 7.1.0 | ||
Summary | 0026832: TFunction_Iterator won't work if ExecutionStatus is Standard_False. | ||||
Description | There 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 Reproduce | Dear Szy, could you please review the modification: CR26832. | ||||
Tags | No tags attached. | ||||
Test case number | Not needed | ||||
|
The simplest way to reproduce this bug is to create just one function and iterate the function with TFunction_Iterator. |
|
Could you check it. |
|
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! |
|
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(); } |
|
for(TFunction_Iterator iterator(aLabel); iterator.More(); iterator.Next()) { // This loop never entered } |
|
So, if there is no bugs, we may close the issue, I suppose. Any proposals for improvement of the code are welcome! |
|
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. |
|
I propose to implement the TFunction_Iterator::More() by just returning {!fIterator.Current().IsEmpty()} if it doesn't consider the executing status. |
|
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? |
|
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(); } |
|
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! |
|
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(). |
|
There is no test-case or a draw-command. Testing is possible only through a new FuncDemo application. |
|
Reviewed. |
|
Branch CR26832 has been updated forcibly by apv. SHA-1: f4d5f9f4d1c43c0a12e6d4c7fec9ccf5e5dc9b81 |
|
Branch CR26832 has been rebased on the current master |
|
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%] |
|
Branch CR26832 has been deleted by kgv. SHA-1: f4d5f9f4d1c43c0a12e6d4c7fec9ccf5e5dc9b81 |
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 |
|
Target Version | 7.0.0 => 7.1.0 |
2015-12-29 17:39 |
|
Note Added: 0049671 | |
2015-12-29 17:39 |
|
Assigned To | szy => vro |
2015-12-29 17:39 |
|
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 | |
2016-03-23 10:50 |
|
Note Added: 0051867 | |
2016-03-23 10:50 |
|
Assigned To | szy => bugmaster |
2016-03-23 10:50 |
|
Status | resolved => reviewed |
2016-03-23 11:12 |
|
Assigned To | bugmaster => apv |
2016-03-23 12:38 | git | Note Added: 0051874 | |
2016-03-23 12:39 |
|
Note Added: 0051875 | |
2016-03-24 10:52 |
|
Test case number | => Not needed |
2016-03-24 11:46 |
|
Note Added: 0051934 | |
2016-03-24 11:46 |
|
Assigned To | apv => bugmaster |
2016-03-24 11:46 |
|
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 |
|
Status | verified => closed |
2016-12-09 16:37 |
|
Fixed in Version | => 7.1.0 |