Re: [Boost-bugs] [Boost C++ Libraries] #3432: Boost:Test pointer error with g++ 64-bit on Mac OS X 10.6 Snow Leopard

Subject: Re: [Boost-bugs] [Boost C++ Libraries] #3432: Boost:Test pointer error with g++ 64-bit on Mac OS X 10.6 Snow Leopard
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2009-09-18 02:47:03


#3432: Boost:Test pointer error with g++ 64-bit on Mac OS X 10.6 Snow Leopard
----------------------------------------------------+-----------------------
 Reporter: Justus Calvin <justus.c79@…> | Owner: rogeeff
     Type: Bugs | Status: new
Milestone: | Component: test
  Version: Boost 1.40.0 | Severity: Problem
 Keywords: test mac "snow leopard" pointer 64-bit |
----------------------------------------------------+-----------------------

Comment(by janm@…):

 Please see the attached patch. This resolves the problem for me on OS X
 and FreeBSD.

 On OS X the single test case example can be made to fail by setting the
 "MallocScribble" environment variable.

 The problem is that the delete in framework_impl::clear() happens through
 a reference to the actual pointer in the m_test_units container, and the
 destructor of the object removes itself from the container. Once the
 object is removed from the container (in the the destructor) the reference
 is no longer valid, and the underlying call to free() uses the now-invalid
 reference.

 Solution: Keep a copy of the pointer to be deleted on the stack.

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/3432#comment:4>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:01 UTC