mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 10:49:34 +02:00
Merge remote-tracking branch
'origin/GP-774-dragonmacher-dt-manager-deadlock--SQUASHED' (Closes #2832)
This commit is contained in:
commit
28138bcba2
1 changed files with 48 additions and 30 deletions
|
@ -1695,6 +1695,9 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void disassociate(DataType dataType) {
|
public void disassociate(DataType dataType) {
|
||||||
|
|
||||||
|
lock.acquire();
|
||||||
|
try {
|
||||||
UniversalID oldDtID = dataType.getUniversalID();
|
UniversalID oldDtID = dataType.getUniversalID();
|
||||||
SourceArchive sourceArchive = dataType.getSourceArchive();
|
SourceArchive sourceArchive = dataType.getSourceArchive();
|
||||||
sourceArchive = resolveSourceArchive(sourceArchive);
|
sourceArchive = resolveSourceArchive(sourceArchive);
|
||||||
|
@ -1724,6 +1727,10 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
|
|
||||||
dataTypeChanged(dataType);
|
dataTypeChanged(dataType);
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
lock.release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private Collection<DataType> filterOutNonSourceSettableDataTypes(
|
private Collection<DataType> filterOutNonSourceSettableDataTypes(
|
||||||
Collection<DataType> datatypes) {
|
Collection<DataType> datatypes) {
|
||||||
|
@ -2694,7 +2701,8 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
creatingDataType++;
|
creatingDataType++;
|
||||||
DBRecord record = functionDefAdapter.createRecord(name, funDef.getComment(), cat.getID(),
|
DBRecord record =
|
||||||
|
functionDefAdapter.createRecord(name, funDef.getComment(), cat.getID(),
|
||||||
DEFAULT_DATATYPE_ID, funDef.hasVarArgs(), funDef.getGenericCallingConvention(),
|
DEFAULT_DATATYPE_ID, funDef.hasVarArgs(), funDef.getGenericCallingConvention(),
|
||||||
sourceArchiveIdValue, universalIdValue, funDef.getLastChangeTime());
|
sourceArchiveIdValue, universalIdValue, funDef.getLastChangeTime());
|
||||||
FunctionDefinitionDB funDefDb =
|
FunctionDefinitionDB funDefDb =
|
||||||
|
@ -3696,8 +3704,14 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
@Override
|
@Override
|
||||||
public DataType getDataType(SourceArchive sourceArchive, UniversalID datatypeID) {
|
public DataType getDataType(SourceArchive sourceArchive, UniversalID datatypeID) {
|
||||||
UniversalID sourceID = sourceArchive == null ? null : sourceArchive.getSourceArchiveID();
|
UniversalID sourceID = sourceArchive == null ? null : sourceArchive.getSourceArchiveID();
|
||||||
|
lock.acquire();
|
||||||
|
try {
|
||||||
return idsToDataTypeMap.getDataType(sourceID, datatypeID);
|
return idsToDataTypeMap.getDataType(sourceID, datatypeID);
|
||||||
}
|
}
|
||||||
|
finally {
|
||||||
|
lock.release();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DataType findDataTypeForID(UniversalID datatypeID) {
|
public DataType findDataTypeForID(UniversalID datatypeID) {
|
||||||
|
@ -4162,7 +4176,11 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
||||||
|
|
||||||
Map<UniversalID, DataType> idMap =
|
Map<UniversalID, DataType> idMap =
|
||||||
map.computeIfAbsent(sourceID, k -> new ConcurrentHashMap<>());
|
map.computeIfAbsent(sourceID, k -> new ConcurrentHashMap<>());
|
||||||
final UniversalID sourceArchiveID = sourceID;
|
UniversalID sourceArchiveID = sourceID;
|
||||||
|
|
||||||
|
// note: this call is atomic and has a lock on the 'idMap'. It may call to a method
|
||||||
|
// that requires a db lock. As such, the call to computeIfAbsent() must be
|
||||||
|
// made while holding the db lock.
|
||||||
return idMap.computeIfAbsent(dataTypeID,
|
return idMap.computeIfAbsent(dataTypeID,
|
||||||
k -> findDataTypeForIDs(sourceArchiveID, dataTypeID));
|
k -> findDataTypeForIDs(sourceArchiveID, dataTypeID));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue