diff --git a/newcoin.vcxproj b/newcoin.vcxproj index 4a7bdee1dd..9837569aed 100644 --- a/newcoin.vcxproj +++ b/newcoin.vcxproj @@ -103,10 +103,10 @@ - + @@ -136,6 +136,7 @@ + @@ -156,7 +157,9 @@ + + diff --git a/newcoin.vcxproj.filters b/newcoin.vcxproj.filters index f569d1ac42..b638955b76 100644 --- a/newcoin.vcxproj.filters +++ b/newcoin.vcxproj.filters @@ -63,9 +63,6 @@ Source Files - - Source Files - Source Files @@ -294,6 +291,18 @@ Source Files + + Source Files + + + Source Files + + + Source Files + + + Source Files + @@ -557,6 +566,7 @@ + diff --git a/src/FieldNames.cpp b/src/FieldNames.cpp index 2946ca2552..545f8af3d0 100644 --- a/src/FieldNames.cpp +++ b/src/FieldNames.cpp @@ -33,15 +33,16 @@ SField::ref SField::getField(int code) if ((type <= 0) || (field <= 0)) return sfInvalid; + { //JED: Did this to fix a deadlock. david you should check. Line after this block also has a scoped lock + // why doe sthis thing even need a mutex? + boost::mutex::scoped_lock sl(mapMutex); - boost::mutex::scoped_lock sl(mapMutex); + std::map::iterator it = codeToField.find(code); + if (it != codeToField.end()) + return *(it->second); - std::map::iterator it = codeToField.find(code); - if (it != codeToField.end()) - return *(it->second); - - switch (type) - { // types we are willing to dynamically extend + switch (type) + { // types we are willing to dynamically extend #define FIELD(name, type, index) #define TYPE(name, type, index) case STI_##type: @@ -50,11 +51,13 @@ SField::ref SField::getField(int code) #undef TYPE break; - default: - return sfInvalid; - } +default: + return sfInvalid; + } - std::string dynName = lexical_cast_i(type) + "/" + lexical_cast_i(field); + std::string dynName = lexical_cast_i(type) + "/" + lexical_cast_i(field); + }// end scope lock + return *(new SField(code, static_cast(type), field, dynName.c_str())); }