Skip to content

Commit

Permalink
Fixed a bug in UndoManager when using undoCurrentTransactionOnly
Browse files Browse the repository at this point in the history
  • Loading branch information
julianstorer committed Aug 15, 2016
1 parent 2417676 commit 91f2453
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions modules/juce_data_structures/undomanager/juce_UndoManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,20 @@ void UndoManager::moveFutureTransactionsToStash()

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()
{
jassert (nextIndex == transactions.size());
while (nextIndex < transactions.size())
{
totalUnitsStored -= transactions.getUnchecked (nextIndex)->getTotalSize();
transactions.remove (nextIndex);
}

for (int i = 0; i < stashedFutureTransactions.size(); ++i)
{
Expand Down

0 comments on commit 91f2453

Please sign in to comment.