MantisBT - Community
View Issue Details
0026625Community[OCCT] OCCT:Visualizationpublic2015-09-01 16:032016-06-02 22:12
dc 
bugmaster 
normalminor 
closedfixed 
[OCCT] 6.8.0 
[OCCT] 7.0.0[OCCT] 7.0.0 
Not needed
0026625: Possible wrong use of vtkSmartPointer<T> in IVtkVTK_ShapeData.cxx
In 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.
N/A
No tags attached.
parent of 0027567closed bugmaster Open CASCADE VIS - possible memory leaks due to use of plain pointers 
Issue History
2015-09-01 16:03dcNew Issue
2015-09-01 16:03dcAssigned To => ski
2015-11-08 22:17abvAssigned Toski => rkv
2015-11-08 22:17abvStatusnew => assigned
2015-11-08 22:17abvTarget Version => 7.0.0
2015-11-09 17:50gitNote Added: 0047960
2015-11-09 17:51rkvAssigned Torkv => kgv
2015-11-09 17:51rkvStatusassigned => resolved
2015-11-09 17:51rkvSteps to Reproduce Updatedbug_revision_view_page.php?rev_id=12187#r12187
2015-11-17 12:39kgvAssigned Tokgv => abv
2015-11-18 15:39abvNote Added: 0048354
2015-11-18 15:39abvAssigned Toabv => bugmaster
2015-11-18 15:39abvStatusresolved => reviewed
2015-11-18 16:48apvAssigned Tobugmaster => apv
2015-11-18 17:01gitNote Added: 0048357
2015-11-18 17:02apvNote Added: 0048358
2015-11-19 17:38skiNote Added: 0048388
2015-11-19 17:39skiAssigned Toapv => bugmaster
2015-11-19 17:40bugmasterTest case number => Not needed
2015-11-19 17:40bugmasterStatusreviewed => tested
2015-11-27 12:21bugmasterChangeset attached => occt master c16915c7
2015-11-27 12:21bugmasterStatustested => verified
2015-11-27 12:21bugmasterResolutionopen => fixed
2016-04-17 14:14gitNote Added: 0053096
2016-04-20 15:42aivFixed in Version => 7.0.0
2016-04-20 15:50aivStatusverified => closed
2016-06-02 22:12abvRelationship addedparent of 0027567

Notes
(0047960)
git   
2015-11-09 17:50   
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.
(0048354)
abv   
2015-11-18 15:39   
No remarks, please test compilation and integrate (if testing, run VTK tests only)
(0048357)
git   
2015-11-18 17:01   
Branch CR26625 has been updated forcibly by apv.

SHA-1: d8d12874143001411621d00d8abb1be17404469b
(0048358)
apv   
2015-11-18 17:02   
Branch CR26625 has been rebased on the current master
(0048388)
ski   
2015-11-19 17:38   
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)
(0053096)
git   
2016-04-17 14:14   
Branch CR26625 has been deleted by kgv.

SHA-1: d8d12874143001411621d00d8abb1be17404469b