mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix submitting with finished transaction id
This commit is contained in:
@@ -83,8 +83,15 @@ public class TransactionGuardImpl extends TransactionGuard {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private Queue<Transaction> getQueue(@Nullable TransactionIdImpl prevTransaction) {
|
||||
return prevTransaction == null ? myQueue : prevTransaction.myQueue;
|
||||
private Queue<Transaction> getQueue(@Nullable TransactionIdImpl transaction) {
|
||||
if (transaction == null) {
|
||||
return myQueue;
|
||||
}
|
||||
if (myCurrentTransaction != null && transaction.myStartCounter > myCurrentTransaction.myStartCounter) {
|
||||
// transaction is finished already, it makes no sense to add to its queue
|
||||
return myCurrentTransaction.myQueue;
|
||||
}
|
||||
return transaction.myQueue;
|
||||
}
|
||||
|
||||
private void pollQueueLater() {
|
||||
|
||||
@@ -160,4 +160,20 @@ class TransactionTest extends LightPlatformTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void "test submit with finished transaction id"() {
|
||||
TransactionGuard.submitTransaction testRootDisposable, {
|
||||
log << '1'
|
||||
TransactionId id = null
|
||||
TransactionGuard.submitTransaction testRootDisposable, {
|
||||
log << '2'
|
||||
id = guard.contextTransaction
|
||||
}
|
||||
SwingUtilities.invokeLater {
|
||||
guard.submitMergeableTransaction testRootDisposable, id, { log << '3' }
|
||||
}
|
||||
UIUtil.dispatchAllInvocationEvents()
|
||||
assert log == ['1', '2', '3']
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user