Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r59198 - in sandbox/pinhole/boost/pinhole: . detail
From: jmcintyre_at_[hidden]
Date: 2010-01-21 11:41:49


Author: jared
Date: 2010-01-21 11:41:49 EST (Thu, 21 Jan 2010)
New Revision: 59198
URL: http://svn.boost.org/trac/boost/changeset/59198

Log:
Fix memory leak of signals data in property_group. Removed unused file.

Removed:
   sandbox/pinhole/boost/pinhole/detail/path.hpp
Text files modified:
   sandbox/pinhole/boost/pinhole/property_group.hpp | 10 ++++++++++
   1 files changed, 10 insertions(+), 0 deletions(-)

Deleted: sandbox/pinhole/boost/pinhole/detail/path.hpp
==============================================================================
--- sandbox/pinhole/boost/pinhole/detail/path.hpp 2010-01-21 11:41:49 EST (Thu, 21 Jan 2010)
+++ (empty file)
@@ -1,84 +0,0 @@
-// Pinhole Find.hpp file
-//
-// Copyright Jared McIntyre 2007-2009.
-// Distributed under the Boost Software License, Version 1.0.
-// (See accompanying file LICENSE_1_0.txt or copy at
-// http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_PINHOLE_DETAIL_PATH
-#define BOOST_PINHOLE_DETAIL_PATH
-
-#include <vector>
-
-namespace boost { namespace pinhole
-{
- namespace detail
- {
- inline
- boost::pinhole::property_group*
- search_single_property_group_based_on_name( boost::pinhole::children_collection::iterator itr,
- boost::pinhole::children_collection::iterator itrEnd,
- const std::string& property_group_name)
- {
- boost::pinhole::property_group* property_group_found = 0;
- for( ; itr != itrEnd; ++itr)
- {
- boost::pinhole::property_group* current_property_group = *itr;
- if(current_property_group->get_name() == property_group_name)
- {
- if(property_group_found != 0)
- {
- std::string strError = "Multiple " + property_group_name + " are found in property_manager::selectSingleNode";
- throw multiple_property_groups(strError.c_str());
- }
- property_group_found = current_property_group;
- }
- }
- if(property_group_found == 0)
- {
- throw no_metadata_defined_error();
- }
- return property_group_found;
- }
-
- inline
- boost::pinhole::property_group*
- search_single_property_group_based_on_property_value( boost::pinhole::children_collection::iterator itr,
- boost::pinhole::children_collection::iterator itrEnd,
- const std::string& property_group_name,
- const std::string& property_name,
- const std::string& property_value )
- {
- boost::pinhole::property_group* property_group_found = 0;
- for(; itr != itrEnd; ++itr)
- {
- boost::pinhole::property_group* current_property_group = *itr;
- if((current_property_group->get_name() == property_group_name) && (current_property_group->get_as_string(property_name) == property_value))
- {
- if(property_group_found != 0)
- {
- std::string strError = "Multiple " + property_group_name + "." + property_name + "=" + property_value + " are found in property_manager::selectSingleNode";
- throw multiple_property_groups(strError.c_str());
- }
- property_group_found = current_property_group;
- }
- }
- if(property_group_found == 0)
- {
- throw no_metadata_defined_error();
- }
- return property_group_found;
- }
-
- inline
- void ThrowIfPathIsRelative(const std::string& path)
- {
- if( path.length() > 0 && path[0] != '/' )
- {
- throw boost::pinhole::invalid_path("A relative path was requested, but no property_group to search from was given.");
- }
- }
- }
-}}
-
-#endif // include guard
\ No newline at end of file

Modified: sandbox/pinhole/boost/pinhole/property_group.hpp
==============================================================================
--- sandbox/pinhole/boost/pinhole/property_group.hpp (original)
+++ sandbox/pinhole/boost/pinhole/property_group.hpp 2010-01-21 11:41:49 EST (Thu, 21 Jan 2010)
@@ -159,6 +159,16 @@
                 (*actionItr).second = NULL;
             }
             m_actions.clear();
+
+ // cleanup all the signal classes
+ signal_collection::iterator signalItr = m_signals.begin();
+ signal_collection::iterator signalItrEnd = m_signals.end();
+ for( ; signalItr != signalItrEnd; ++signalItr )
+ {
+ delete (*signalItr).second;
+ (*signalItr).second = NULL;
+ }
+ m_signals.clear();
         }
 
         property_group& operator=( const property_group& other )


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk