mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 18:29:37 +02:00
Merge remote-tracking branch
'origin/GP-4798_ghidra1_CorrectedDTArchiveTransactionError' (Closes #6768)
This commit is contained in:
commit
d88350e718
2 changed files with 20 additions and 8 deletions
|
@ -319,7 +319,7 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
|||
|
||||
private void initPackedDatabase(ResourceFile packedDBfile, OpenMode openMode,
|
||||
TaskMonitor monitor) throws CancelledException, IOException {
|
||||
long txId = dbHandle.startTransaction();
|
||||
Long txId = dbHandle.startTransaction();
|
||||
try {
|
||||
init(openMode, monitor);
|
||||
|
||||
|
@ -337,6 +337,9 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
|||
}
|
||||
catch (VersionException e) {
|
||||
if (openMode == OpenMode.UPDATE && e.isUpgradable()) {
|
||||
// Try again with UPGRADE mode
|
||||
dbHandle.endTransaction(txId, true);
|
||||
txId = null;
|
||||
initPackedDatabase(packedDBfile, OpenMode.UPGRADE, monitor);
|
||||
}
|
||||
else {
|
||||
|
@ -345,9 +348,11 @@ abstract public class DataTypeManagerDB implements DataTypeManager {
|
|||
}
|
||||
}
|
||||
finally {
|
||||
if (txId != null) {
|
||||
dbHandle.endTransaction(txId, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructor for a database-backed <code>DataTypeManagerDB</code> extension.
|
||||
|
|
|
@ -836,7 +836,7 @@ public class StandAloneDataTypeManager extends DataTypeManagerDB implements Clos
|
|||
}
|
||||
|
||||
protected void initTransactionState() {
|
||||
dbHandle.setMaxUndos(NUM_UNDOS);
|
||||
clearUndo();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -953,6 +953,8 @@ public class StandAloneDataTypeManager extends DataTypeManagerDB implements Clos
|
|||
protected synchronized void clearUndo() {
|
||||
undoList.clear();
|
||||
redoList.clear();
|
||||
dbHandle.setMaxUndos(0);
|
||||
dbHandle.setMaxUndos(NUM_UNDOS);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1037,7 +1039,12 @@ public class StandAloneDataTypeManager extends DataTypeManagerDB implements Clos
|
|||
|
||||
@Override
|
||||
public synchronized void close() {
|
||||
clearUndo();
|
||||
if (dbHandle.isTransactionActive()) {
|
||||
Msg.error(this, "DTM closed with active transaction",
|
||||
new RuntimeException("DTM closed with active transaction"));
|
||||
}
|
||||
undoList.clear();
|
||||
redoList.clear();
|
||||
if (!dbHandle.isClosed()) {
|
||||
dbHandle.close();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue