View Issue Details

IDProjectCategoryView StatusLast Update
0028889CommunityOCCT:Visualizationpublic2017-09-29 16:28
ReporterVico Liang Assigned Tokgv  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
PlatformWindowsOSVC++ 2013 
Product Version7.1.0 
Target Version7.2.0Fixed in Version7.2.0 
Summary0028889: Visualization, V3d_View - View specific Graphic3d_Structure should be removed if the view is removed
DescriptionThere are some Graphic3d_Structure are view specific, such as V3d_Trihedron, Grid. These structure should be removed if the host view is removed and it will caused crash if not.

Please see below cases:

1. view->TriedronDisplay();
2. view->Remove();
3. view->StructureManager()->RecomputeStructures();

The last step will access deleted V3d_Trihedron pointer in below method:
 class V3d_Trihedron::TrihedronStructure
  virtual void Compute() Standard_OVERRIDE { myTrihedron->compute(); }

Steps To ReproduceN/A
TagsNo tags attached.
Test case numberNot needed

Relationships

parent of 0028927 closedbugmaster Open CASCADE Visualization - Graphic3d_StructureManager destructor should invalidate its pointer in Graphic3d_Structure 

Activities

kgv

2017-07-07 15:05

developer   ~0068089

Though removing structures within V3d_View::Remove() would be correct,
I don't see what kind of problem you currently have.

V3d_Trihedron::myStructure is a handle to V3d_Trihedron::TrihedronStructure,
so that raw pointer V3d_Trihedron::TrihedronStructure::myTrihedron should never point to invalid address.

I don't get any crashes on your test case on current master.

Vico Liang

2017-07-08 20:27

developer   ~0068105

Dear kgv,

V3d_View owns V3d_Trihedron object, and after V3d_View deleted, V3d_Trihedron will be deleted too. But the back reference inside class V3d_Trihedron::TrihedronStructure has a raw pointer reference to V3d_Trihedron, this pointer will be become to a dangling pointer pointer to a deleted object V3d_Trihedron. When the viewer update the Structure, it will access this dangling pointer to cause crash.

Vico Liang

2017-07-08 20:29

developer   ~0068106

Below compute method will access the dangling pointer myTrihedron:
 class V3d_Trihedron::TrihedronStructure
   virtual void Compute() Standard_OVERRIDE { myTrihedron->compute(); }

kgv

2017-07-08 20:32

developer   ~0068107

OK, so the test code in the bug description should include NULLifying view before calling RecomputeStructures().

Vico Liang

2017-07-08 20:40

developer   ~0068108

To reproduce this bug, please Remove() the view firstly and make sure V3d_Trihedron is deleted. V3d_Trihedron::TrihedronStructure::Compute() method should be called by StructureManager()->RecomputeStructures() after view being removed.

Vico Liang

2017-07-08 20:43

developer   ~0068109

Dear kgv, You're right, the view should be Nullified before calling RecomputeStructures().

git

2017-07-09 11:04

administrator   ~0068110

Branch CR28889 has been created by kgv.

SHA-1: 1a7ea872ddc82b346b7952c334ef4e99237890da


Detailed log of new commits:

Author: kgv
Date: Sun Jul 9 10:48:23 2017 +0300

    V3d_View::Remove() - erase trihedron and grid structures from structure manager

Author: kgv
Date: Sun Jul 9 10:48:23 2017 +0300

    0028889: Visualization, V3d_View - View specific Graphic3d_Structure should be removed if the view is removed
    
    Cosmetics.

git

2017-07-10 08:54

administrator   ~0068113

Branch CR28889_1 has been created by kgv.

SHA-1: 475c2302d4e46524e9934d612174ee4da790d28a


Detailed log of new commits:

Author: kgv
Date: Mon Jul 10 08:54:15 2017 +0300

    0028889: Visualization, V3d_View - View specific Graphic3d_Structure should be removed if the view is removed
    
    V3d_View::Remove() - erase trihedron and grid structures from structure manager.

kgv

2017-07-10 08:55

developer   ~0068114

Please take the patch.

CR28889-master-KGV-Products-Debian70-64-opt-tests-compare-linux - Build # 1 - Successful:
Check console output at http://jenkins-test-10.nnov.opencascade.com:8080/job/CR28889-master-KGV-Products-Debian70-64-opt-tests-compare-linux/1/ to view the results.

CR28889-master-KGV-Products-Windows-64-VC10-opt-tests-compare-windows - Build # 1 - Successful:
Check console output at http://jenkins-test-10.nnov.opencascade.com:8080/job/CR28889-master-KGV-Products-Windows-64-VC10-opt-tests-compare-windows/1/ to view the results.

mkv

2017-07-10 12:25

tester   ~0068151

Dear BugMaster,
Branch CR28889 from occt git-repository (and master from products git-repository) was compiled on Linux, MacOS and Windows platforms and tested on Release mode.
SHA-1: 1a7ea872ddc82b346b7952c334ef4e99237890da

Number of compiler warnings:

occt component :
Linux: 0 (0 on master)
Windows: 0 (0 on master)
MacOS : 0 (0 on master)

products component :
Linux: 64 (64 on master)
Windows: 0 (0 on master)
MacOS : 1150

Regressions/Differences/Improvements:
No regressions/differences

Testing cases:
Not needed

Testing on Linux:
occt component :
Total CPU difference: 19340.849999999904 / 19289.600000000315 [+0.27%]
Total MEMORY difference: 92451359 / 91871495 [+0.63%]
products component :
Total CPU difference: 6496.0000000000755 / 6487.850000000069 [+0.13%]
Total MEMORY difference: 37582090 / 37650261 [-0.18%]
Testing on Windows:
occt component :
Total CPU difference: 17880.195015898556 / 17783.926798798613 [+0.54%]
Total MEMORY difference: 59026034 / 59027676 [-0.00%]
products component :
Total CPU difference: 6694.377312400081 / 6584.849010300061 [+1.66%]
Total MEMORY difference: 27838712 / 28099545 [-0.93%]

There are no differences in images found by testdiff.

mkv

2017-07-10 12:26

tester   ~0068152

Dear BugMaster,
Branch CR28889 from occt git-repository is TESTED.

git

2017-07-17 10:05

administrator   ~0068346

Branch CR28889 has been deleted by kgv.

SHA-1: 1a7ea872ddc82b346b7952c334ef4e99237890da

git

2017-07-17 10:05

administrator   ~0068347

Branch CR28889_1 has been deleted by kgv.

SHA-1: 475c2302d4e46524e9934d612174ee4da790d28a

Related Changesets

occt: master 475c2302

2017-07-10 05:54:15

kgv

Details Diff
0028889: Visualization, V3d_View - View specific Graphic3d_Structure should be removed if the view is removed

V3d_View::Remove() - erase trihedron and grid structures from structure manager.
Affected Issues
0028889
mod - src/Aspect/Aspect_CircularGrid.cxx Diff File
mod - src/Aspect/Aspect_CircularGrid.hxx Diff File
mod - src/Aspect/Aspect_Grid.cxx Diff File
mod - src/Aspect/Aspect_Grid.hxx Diff File
mod - src/Aspect/Aspect_RectangularGrid.cxx Diff File
mod - src/Aspect/Aspect_RectangularGrid.hxx Diff File
mod - src/V3d/V3d_CircularGrid.cxx Diff File
mod - src/V3d/V3d_CircularGrid.hxx Diff File
mod - src/V3d/V3d_RectangularGrid.cxx Diff File
mod - src/V3d/V3d_RectangularGrid.hxx Diff File
mod - src/V3d/V3d_Trihedron.cxx Diff File
mod - src/V3d/V3d_Trihedron.hxx Diff File
mod - src/V3d/V3d_View.cxx Diff File
mod - src/V3d/V3d_View.hxx Diff File
mod - src/V3d/V3d_View_4.cxx Diff File

Issue History

Date Modified Username Field Change
2017-07-04 12:41 Vico Liang New Issue
2017-07-04 12:41 Vico Liang Assigned To => kgv
2017-07-04 12:45 Vico Liang Description Updated
2017-07-07 15:05 kgv Note Added: 0068089
2017-07-07 15:05 kgv Assigned To kgv => Vico Liang
2017-07-07 15:05 kgv Status new => feedback
2017-07-08 20:27 Vico Liang Note Added: 0068105
2017-07-08 20:27 Vico Liang Assigned To Vico Liang => kgv
2017-07-08 20:27 Vico Liang Status feedback => assigned
2017-07-08 20:29 Vico Liang Note Added: 0068106
2017-07-08 20:32 kgv Note Added: 0068107
2017-07-08 20:40 Vico Liang Note Added: 0068108
2017-07-08 20:43 Vico Liang Note Added: 0068109
2017-07-09 10:38 kgv Summary View specific Graphic3d_Structure should be removed if the view is removed => Visualization, V3d_View - View specific Graphic3d_Structure should be removed if the view is removed
2017-07-09 11:04 git Note Added: 0068110
2017-07-10 08:54 git Note Added: 0068113
2017-07-10 08:55 kgv Note Added: 0068114
2017-07-10 08:55 kgv Assigned To kgv => bugmaster
2017-07-10 08:55 kgv Severity crash => minor
2017-07-10 08:55 kgv Status assigned => resolved
2017-07-10 08:55 kgv Status resolved => reviewed
2017-07-10 08:55 kgv Steps to Reproduce Updated
2017-07-10 12:25 mkv Note Added: 0068151
2017-07-10 12:26 mkv Note Added: 0068152
2017-07-10 12:26 mkv Status reviewed => tested
2017-07-10 12:26 mkv Test case number => Not needed
2017-07-14 13:55 kgv Changeset attached => occt master 475c2302
2017-07-14 13:55 kgv Assigned To bugmaster => kgv
2017-07-14 13:55 kgv Status tested => verified
2017-07-14 13:55 kgv Resolution open => fixed
2017-07-17 10:05 git Note Added: 0068346
2017-07-17 10:05 git Note Added: 0068347
2017-07-19 17:41 kgv Relationship added parent of 0028927
2017-09-29 16:18 aiv Fixed in Version => 7.2.0
2017-09-29 16:28 aiv Status verified => closed