The following change to BufferView::removeAutoInsets() at around BufferView2.C:197 seems to do the trick. Recompiling with updated cvs so this will take forever so I'm going home. Someone care to check this with their own tests?
Michael, I can't crash LyX using the method you described or any of my own tests can you try again please. This seems correct to me so there shouldn't be any crashing etc. unless there is a problem in erase(). while (pit != pend) { if (pit->autoDelete()) { removed = true; pos_type const pos = pit.getPos(); par->erase(pos); + // get the next valid iterator position + Paragraph::inset_iterator pit = par->InsetIterator(pos); if (cur_par == par) { if (cur_pos > pos) --cur_pos; } } else { ++pit; } } Allan. (ARRae)