Browse Source

Fixed a bug in UndoManager when using undoCurrentTransactionOnly

tags/2021-05-28
jules 9 years ago
parent
commit
91f2453d11
1 changed files with 8 additions and 3 deletions
  1. +8
    -3
      modules/juce_data_structures/undomanager/juce_UndoManager.cpp

+ 8
- 3
modules/juce_data_structures/undomanager/juce_UndoManager.cpp View File

@@ -171,15 +171,20 @@ void UndoManager::moveFutureTransactionsToStash()
while (nextIndex < transactions.size()) while (nextIndex < transactions.size())
{ {
totalUnitsStored -= transactions.getLast()->getTotalSize();
stashedFutureTransactions.add (transactions.removeAndReturn (nextIndex));
ActionSet* removed = transactions.removeAndReturn (nextIndex);
stashedFutureTransactions.add (removed);
totalUnitsStored -= removed->getTotalSize();
} }
} }
} }
void UndoManager::restoreStashedFutureTransactions() void UndoManager::restoreStashedFutureTransactions()
{ {
jassert (nextIndex == transactions.size());
while (nextIndex < transactions.size())
{
totalUnitsStored -= transactions.getUnchecked (nextIndex)->getTotalSize();
transactions.remove (nextIndex);
}
for (int i = 0; i < stashedFutureTransactions.size(); ++i) for (int i = 0; i < stashedFutureTransactions.size(); ++i)
{ {


Loading…
Cancel
Save