Skip to Content.
Sympa Menu

cgal-discuss - [cgal-discuss] Re: Add a fresh pointer member inside Point_set_scene_item class, Heap corruption when destruction

Subject: CGAL users discussion list

List archive

[cgal-discuss] Re: Add a fresh pointer member inside Point_set_scene_item class, Heap corruption when destruction


Chronological Thread 
  • From: cmodel <>
  • To:
  • Subject: [cgal-discuss] Re: Add a fresh pointer member inside Point_set_scene_item class, Heap corruption when destruction
  • Date: Wed, 22 Dec 2010 05:28:43 -0800 (PST)


Best Regards,
Leon(Shanghai,China)

--- On Tue, 12/21/10, Laurent Rineau (GeometryFactory) [via cgal-discuss] <[hidden email]> wrote:

From: Laurent Rineau (GeometryFactory) [via cgal-discuss] <[hidden email]>
Subject: Re: Add a fresh pointer member inside Point_set_scene_item class, Heap corruption when destruction
To: "cmodel" <[hidden email]>
Date: Tuesday, December 21, 2010, 2:15 AM



        Le mardi 21 décembre 2010 04:51:49, cmodel a écrit :

> Here is the issue,

>

> I tried adding one pointer member, like std::vector *m_point2;

> inside Point_set_scene_item class,

>

> typedef CGAL::Triangulation_2 Triangulation2;

>

> typedef Triangulation2::Face_handle Face_handle;

> typedef Triangulation2::Finite_faces_iterator Finite_faces_iterator;

> typedef Triangulation2::Point  Point2;

>

>

> then in destructor, add the following:

>

>   Q_ASSERT(m_point2 != NULL);

>   delete m_point2; m_point2 = NULL;

Replace by:


  if(m_point_2) {

    delete m_point2;

  };


And add:


  m_point2=NULL;


in the constructor.


> in bool Point_set_scene_item::read_xyz_point_set(std::istream& stream)

> code section, add the following:

>

>   m_point2 = new std::vector;


Change that to:


  if(m_point2==NULL)

    m_point2 = new std::vector;

  else

    m_point2->clear();


> Then build the project, run, got " heap corruption debug error ", did I use

> wrong memory?


Did you clean the whole project before rebuilding it?


Leon> OK, I have cleaned the project and rebuild, it solved this issue.

--

Laurent Rineau, PhD

Release Manager of the CGAL Project       http://www.cgal.org/
R&D Engineer at GeometryFactory           http://www.geometryfactory.com/

--

You are currently subscribed to cgal-discuss.

To unsubscribe or access the archives, go to

https://lists-sop.inria.fr/wws/info/cgal-discuss


       
       

       

       
       
                View message @ http://cgal-discuss.949826.n4.nabble.com/Add-a-fresh-pointer-member-inside-Point-set-scene-item-class-Heap-corruption-when-destruction-tp3121294p3129423.html

               
                To unsubscribe from Add a fresh pointer member inside Point_set_scene_item class, Heap corruption when destruction, click here.
       





View this message in context: Re: Add a fresh pointer member inside Point_set_scene_item class, Heap corruption when destruction
Sent from the cgal-discuss mailing list archive at Nabble.com.



Archive powered by MHonArc 2.6.16.

Top of Page