From Emmanuel Roche, "I'm joining two zip files to this mail for the modified sources and include files of osgIntrospection.
The modifications I made are very small but they are absolutely usefull to use osgIntrospection with visual studio 7.1 or 8 in debug modes. This should also solve other minor common problems (converter memory leak, virtual destructor for PropertyInfo, etc...). I choosed two function names : Reflection::uninitialize() and Type::reset(), this can of course be changed if someone has a better idea... I made the changes against OSG 2.2.0 public release. I tested the result with VS 7.1, VS 7.1 SP1, VS 8.0 SP1 and AQTime 5.0 on Windows XP SP2... All 4 seem to agree : they detected memory leaks before and don't anymore. Sorry I haven't take the time to test that on linux but the changes are so small I doubt there could be a problem... I let you check that on your side :-). I hope this will help making OSG an even more wonderfull library."
This commit is contained in:
@@ -115,7 +115,11 @@ namespace osgIntrospection
|
||||
|
||||
protected:
|
||||
virtual void getInheritedProviders(CustomAttributeProviderList& providers) const = 0;
|
||||
virtual ~CustomAttributeProvider() {}
|
||||
virtual ~CustomAttributeProvider() {
|
||||
for(CustomAttributeList::iterator it = attribs_.begin(); it != attribs_.end(); ++it) {
|
||||
delete (*it);
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
CustomAttributeList attribs_;
|
||||
|
||||
@@ -354,6 +354,8 @@ namespace osgIntrospection
|
||||
/// this method, for example NoDefaultValueAttribute.
|
||||
Value getDefaultValue() const;
|
||||
|
||||
virtual ~PropertyInfo() {};
|
||||
|
||||
protected:
|
||||
virtual void getInheritedProviders(CustomAttributeProviderList& providers) const;
|
||||
|
||||
|
||||
@@ -79,6 +79,11 @@ namespace osgIntrospection
|
||||
static const Converter* getConverter(const Type& source, const Type& dest);
|
||||
static bool getConversionPath(const Type& source, const Type& dest, ConverterList& conv);
|
||||
|
||||
// This function should be called (at least on windows platforms using Visual Studio 7.1 or 8 as compiler) to unregister
|
||||
// all the known types before exiting your program: otherwise, you will get a lot of false positive memory leaks in debug builds.
|
||||
// It might also be used to dynamically reload the description of the known types (?)
|
||||
static void uninitialize();
|
||||
|
||||
private:
|
||||
template<typename C> friend class Reflector;
|
||||
template<typename C> friend struct TypeNameAliasProxy;
|
||||
|
||||
@@ -253,6 +253,10 @@ namespace osgIntrospection
|
||||
Value createInstance(ValueList& args) const;
|
||||
inline Value createInstance() const;
|
||||
|
||||
// This function is called internally to reset all the elements contained in that type.
|
||||
// used in the type loading process: it solves a false positive issue on VS 7.1 and 8 compilers in debug builds.
|
||||
void reset();
|
||||
|
||||
protected:
|
||||
Type(const ExtendedTypeInfo &ti)
|
||||
: _ti(ti),
|
||||
|
||||
Reference in New Issue
Block a user