mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +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
|
||||
public void disassociate(DataType dataType) {
|
||||
|
||||
lock.acquire();
|
||||
try {
|
||||
UniversalID oldDtID = dataType.getUniversalID();
|
||||
SourceArchive sourceArchive = dataType.getSourceArchive();
|
||||
sourceArchive = resolveSourceArchive(sourceArchive);
|
||||
|
@ -1724,6 +1727,10 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
|||
|
||||
dataTypeChanged(dataType);
|
||||
}
|
||||
finally {
|
||||
lock.release();
|
||||
}
|
||||
}
|
||||
|
||||
private Collection<DataType> filterOutNonSourceSettableDataTypes(
|
||||
Collection<DataType> datatypes) {
|
||||
|
@ -2694,7 +2701,8 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
|||
}
|
||||
try {
|
||||
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(),
|
||||
sourceArchiveIdValue, universalIdValue, funDef.getLastChangeTime());
|
||||
FunctionDefinitionDB funDefDb =
|
||||
|
@ -3696,8 +3704,14 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
|||
@Override
|
||||
public DataType getDataType(SourceArchive sourceArchive, UniversalID datatypeID) {
|
||||
UniversalID sourceID = sourceArchive == null ? null : sourceArchive.getSourceArchiveID();
|
||||
lock.acquire();
|
||||
try {
|
||||
return idsToDataTypeMap.getDataType(sourceID, datatypeID);
|
||||
}
|
||||
finally {
|
||||
lock.release();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public DataType findDataTypeForID(UniversalID datatypeID) {
|
||||
|
@ -4162,7 +4176,11 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
|||
|
||||
Map<UniversalID, DataType> idMap =
|
||||
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,
|
||||
k -> findDataTypeForIDs(sourceArchiveID, dataTypeID));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue