From 3fccb0f37374a5e63ca68ae33cc0ec3bd1ed2847 Mon Sep 17 00:00:00 2001 From: David Rose Date: Tue, 2 Oct 2001 22:56:56 +0000 Subject: [PATCH] workaround for windows crash --- dtool/src/interrogate/interrogateBuilder.cxx | 20 +++++++++---------- .../src/interrogatedb/interrogateDatabase.cxx | 19 +++++++++--------- dtool/src/interrogatedb/interrogateDatabase.h | 4 ++-- 3 files changed, 22 insertions(+), 21 deletions(-) diff --git a/dtool/src/interrogate/interrogateBuilder.cxx b/dtool/src/interrogate/interrogateBuilder.cxx index c6644b4d54..5f8410e974 100644 --- a/dtool/src/interrogate/interrogateBuilder.cxx +++ b/dtool/src/interrogate/interrogateBuilder.cxx @@ -1575,28 +1575,28 @@ get_function(CPPInstance *function, string description, InterrogateDatabase::get_ptr()->get_next_index(); _functions_by_name[function_name] = index; - InterrogateFunction ifunction; - ifunction._name = function->get_local_name(scope); - ifunction._scoped_name = descope(function->get_local_name(&parser)); + InterrogateFunction *ifunction = new InterrogateFunction; + ifunction->_name = function->get_local_name(scope); + ifunction->_scoped_name = descope(function->get_local_name(&parser)); if (function->_leading_comment != (CPPCommentBlock *)NULL) { - ifunction._comment = trim_blanks(function->_leading_comment->_comment); + ifunction->_comment = trim_blanks(function->_leading_comment->_comment); } ostringstream prototype; function->output(prototype, 0, &parser, false); prototype << ";"; - ifunction._prototype = prototype.str(); + ifunction->_prototype = prototype.str(); if (struct_type != (CPPStructType *)NULL) { // The function is a method. - ifunction._flags |= InterrogateFunction::F_method; - ifunction._class = get_type(struct_type, false); + ifunction->_flags |= InterrogateFunction::F_method; + ifunction->_class = get_type(struct_type, false); } - ifunction._flags |= flags; - ifunction._instances.insert(InterrogateFunction::Instances::value_type(function_signature, function)); - ifunction._expression = expression; + ifunction->_flags |= flags; + ifunction->_instances.insert(InterrogateFunction::Instances::value_type(function_signature, function)); + ifunction->_expression = expression; InterrogateDatabase::get_ptr()->add_function(index, ifunction); diff --git a/dtool/src/interrogatedb/interrogateDatabase.cxx b/dtool/src/interrogatedb/interrogateDatabase.cxx index f6de845733..b475ac470c 100644 --- a/dtool/src/interrogatedb/interrogateDatabase.cxx +++ b/dtool/src/interrogatedb/interrogateDatabase.cxx @@ -309,7 +309,7 @@ get_function(FunctionIndex function) { if (fi == _function_map.end()) { return bogus_function; } - return (*fi).second; + return *(*fi).second; } //////////////////////////////////////////////////////////////////// @@ -529,12 +529,12 @@ add_type(TypeIndex index, const InterrogateType &type) { // the given index number. //////////////////////////////////////////////////////////////////// void InterrogateDatabase:: -add_function(FunctionIndex index, const InterrogateFunction &function) { +add_function(FunctionIndex index, InterrogateFunction *function) { bool inserted = _function_map.insert(FunctionMap::value_type(index, function)).second; assert(inserted); - if (function.is_global()) { + if (function->is_global()) { _global_functions.push_back(index); } _all_functions.push_back(index); @@ -608,7 +608,7 @@ update_type(TypeIndex type) { InterrogateFunction &InterrogateDatabase:: update_function(FunctionIndex function) { check_latest(); - return _function_map[function]; + return *_function_map[function]; } //////////////////////////////////////////////////////////////////// @@ -734,7 +734,7 @@ remap_indices(int first_index, IndexRemapper &remap) { (*wi).second.remap_indices(remap); } for (fi = _function_map.begin(); fi != _function_map.end(); ++fi) { - (*fi).second.remap_indices(remap); + (*fi).second->remap_indices(remap); } for (ti = _type_map.begin(); ti != _type_map.end(); ++ti) { (*ti).second.remap_indices(remap); @@ -794,7 +794,7 @@ write(ostream &out, InterrogateModuleDef *def) const { out << _function_map.size() << "\n"; FunctionMap::const_iterator fi; for (fi = _function_map.begin(); fi != _function_map.end(); ++fi) { - out << (*fi).first << " " << (*fi).second << "\n"; + out << (*fi).first << " " << *(*fi).second << "\n"; } out << _wrapper_map.size() << "\n"; @@ -955,9 +955,10 @@ read_new(istream &in, InterrogateModuleDef *def) { while (num_functions > 0) { FunctionIndex index; - InterrogateFunction function(def); - in >> index >> function; + InterrogateFunction *function = new InterrogateFunction(def); + in >> index >> *function; if (in.fail()) { + delete function; return false; } @@ -1125,7 +1126,7 @@ merge_from(const InterrogateDatabase &other) { fi != other._function_map.end(); ++fi) { FunctionIndex other_function_index = (*fi).first; - const InterrogateFunction &other_function = (*fi).second; + InterrogateFunction *other_function = (*fi).second; add_function(other_function_index, other_function); update_function(other_function_index).remap_indices(remap); } diff --git a/dtool/src/interrogatedb/interrogateDatabase.h b/dtool/src/interrogatedb/interrogateDatabase.h index 0d21855370..aec745a2cc 100644 --- a/dtool/src/interrogatedb/interrogateDatabase.h +++ b/dtool/src/interrogatedb/interrogateDatabase.h @@ -89,7 +89,7 @@ public: // Functions to build the database. int get_next_index(); void add_type(TypeIndex index, const InterrogateType &type); - void add_function(FunctionIndex index, const InterrogateFunction &function); + void add_function(FunctionIndex index, InterrogateFunction *function); void add_wrapper(FunctionWrapperIndex index, const InterrogateFunctionWrapper &wrapper); void add_manifest(ManifestIndex index, const InterrogateManifest &manifest); @@ -124,7 +124,7 @@ private: // This data is loaded from the various database files. typedef map TypeMap; TypeMap _type_map; - typedef map FunctionMap; + typedef map FunctionMap; FunctionMap _function_map; typedef map FunctionWrapperMap; FunctionWrapperMap _wrapper_map;