From 29c199d4fcc2c791336636855a2e2c9d7908cd37 Mon Sep 17 00:00:00 2001 From: EvanR Date: Tue, 6 Jan 2009 16:51:26 -0600 Subject: [PATCH] Fixed one segfault during undo. It was caused by a wrong algorithm to erase the future commands when committing from inside the undo history. --- src/seq.cpp | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/src/seq.cpp b/src/seq.cpp index 02b2a97..f1b8fd6 100644 --- a/src/seq.cpp +++ b/src/seq.cpp @@ -931,20 +931,21 @@ void reset_record_flags(){ void set_undo(Command* c){ if(undo_ptr != undo_stack.end()){ - //printf("changing the past, need to erase the future\n"); - std::list::iterator ptr = undo_ptr; - ptr++; - int N=0; - while(undo_ptr != undo_stack.end()){ - N++; - undo_ptr++; - } - for(int i=0; i::iterator nptr = undo_number.end(); + nptr--; + while(nptr != undo_nptr){ + int N = *nptr; +printf("deleting %d commands\n",N); + for(int i=0; iredo(); @@ -952,7 +953,7 @@ void set_undo(Command* c){ void undo_push(int n){ if(n==0){return;} -//printf("pushing number of commands %d\n",n); +printf("pushing number of commands %d\n",n); undo_number.push_back(n); undo_nptr++; } @@ -962,7 +963,7 @@ void do_undo(){ printf("no more to undo!\n"); return; } -//printf("undoing\n"); +printf("undoing\n"); int N = *undo_nptr; undo_nptr--; for(int i=0; i::iterator c = undo_stack.end(); -- 2.11.4.GIT