View Issue Details

IDProjectCategoryView StatusLast Update
0026625CommunityOCCT:Visualizationpublic2016-06-02 22:12
Reporterdc Assigned Tobugmaster  
PrioritynormalSeverityminor 
Status closedResolutionfixed 
Product Version6.8.0 
Target Version7.0.0Fixed in Version7.0.0 
Summary0026625: Possible wrong use of vtkSmartPointer<T> in IVtkVTK_ShapeData.cxx
DescriptionIn the constructor of the class there are several invocations in this form:

vtkSmartPointer<vtkObject> MyObject = vtkObject::New()

However according to the vtk wiki this may be wrong. http://www.vtk.org/Wiki/VTK/Tutorials/SmartPointers


Excerpt:
#include <vtkSmartPointer.h>
Then you can create an object as follows:

vtkSmartPointer<vtkObject> MyObject = vtkSmartPointer<vtkObject>::New();

Note the special syntax on the right of the assignment. One almost never wants to assign a raw object pointer to a smart pointer, as is done here:

vtkSmartPointer<vtkObject> MyObject = vtkObject::New();

This is almost always a coding error, because the reference count is incremented, requiring an explicit Delete later.
Steps To ReproduceN/A
TagsNo tags attached.
Test case numberNot needed

Relationships

parent of 0027567 closedbugmaster Open CASCADE VIS - possible memory leaks due to use of plain pointers 

Activities

git

2015-11-09 17:50

administrator   ~0047960

Branch CR26625 has been created by rkv.

SHA-1: f728c562d3ff912ecbbd9c90e8ec470ab15ac9f8


Detailed log of new commits:

Author: rkv
Date: Mon Nov 9 17:49:42 2015 +0300

    0026625: Possible wrong use of vtkSmartPointer<T> in IVtkVTK_ShapeData.cxx
    
    Use vtkSmartPointer<XXX>::New() instead of XXX::New() when initializing fields of vtkSmartPointer<XXX> types.

abv

2015-11-18 15:39

manager   ~0048354

No remarks, please test compilation and integrate (if testing, run VTK tests only)

git

2015-11-18 17:01

administrator   ~0048357

Branch CR26625 has been updated forcibly by apv.

SHA-1: d8d12874143001411621d00d8abb1be17404469b

apv

2015-11-18 17:02

tester   ~0048358

Branch CR26625 has been rebased on the current master

ski

2015-11-19 17:38

developer   ~0048388

Dear BugMaster,

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

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

git

2016-04-17 14:14

administrator   ~0053096

Branch CR26625 has been deleted by kgv.

SHA-1: d8d12874143001411621d00d8abb1be17404469b

Related Changesets

occt: master c16915c7

2015-11-09 14:49:42

rkv


Committer: bugmaster Details Diff
0026625: Possible wrong use of vtkSmartPointer<T> in IVtkVTK_ShapeData.cxx

Use vtkSmartPointer<XXX>::New() instead of XXX::New() when initializing fields of vtkSmartPointer<XXX> types.
Affected Issues
0026625
mod - src/IVtkVTK/IVtkVTK_ShapeData.cxx Diff File

Issue History

Date Modified Username Field Change
2015-09-01 16:03 dc New Issue
2015-09-01 16:03 dc Assigned To => ski
2015-11-08 22:17 abv Assigned To ski => rkv
2015-11-08 22:17 abv Status new => assigned
2015-11-08 22:17 abv Target Version => 7.0.0
2015-11-09 17:50 git Note Added: 0047960
2015-11-09 17:51 rkv Assigned To rkv => kgv
2015-11-09 17:51 rkv Status assigned => resolved
2015-11-09 17:51 rkv Steps to Reproduce Updated
2015-11-17 12:39 kgv Assigned To kgv => abv
2015-11-18 15:39 abv Note Added: 0048354
2015-11-18 15:39 abv Assigned To abv => bugmaster
2015-11-18 15:39 abv Status resolved => reviewed
2015-11-18 16:48 apv Assigned To bugmaster => apv
2015-11-18 17:01 git Note Added: 0048357
2015-11-18 17:02 apv Note Added: 0048358
2015-11-19 17:38 ski Note Added: 0048388
2015-11-19 17:39 ski Assigned To apv => bugmaster
2015-11-19 17:40 bugmaster Test case number => Not needed
2015-11-19 17:40 bugmaster Status reviewed => tested
2015-11-27 12:21 bugmaster Changeset attached => occt master c16915c7
2015-11-27 12:21 bugmaster Status tested => verified
2015-11-27 12:21 bugmaster Resolution open => fixed
2016-04-17 14:14 git Note Added: 0053096
2016-04-20 15:42 aiv Fixed in Version => 7.0.0
2016-04-20 15:50 aiv Status verified => closed
2016-06-02 22:12 abv Relationship added parent of 0027567