And now, with the actual patch. The attached doesn't do much other than code cleanup, and I've inserted some comments about how to fix bug 3440, which I don't propose to do now. There's no actual change to the logic. Indentation will be fixed. Makes the diff hard to read.
Seeking OK to commit. Richard -- ================================================================== Richard G Heck, Jr Professor of Philosophy Brown University http://frege.brown.edu/heck/ ================================================================== Get my public key from http://sks.keyserver.penguin.de Hash: 0x1DE91F1E66FFBDEC Learn how to sign your email using Thunderbird and GnuPG at: http://dudu.dyn.2-h.org/nist/gpg-enigmail-howto
Index: BufferView.cpp =================================================================== --- BufferView.cpp (revision 18504) +++ BufferView.cpp (working copy) @@ -183,14 +183,20 @@ return; } + //FIXME Fix for bug 3440 is here. // If we are closing current buffer, switch to the first in // buffer list. if (!b) { LYXERR(Debug::INFO) << BOOST_CURRENT_FUNCTION << " No Buffer!" << endl; // We are closing the buffer, use the first buffer as current + //FIXME 3440 + // if (last_buffer_) buffer_ = last_buffer_; + // also check that this is in theBufferList()? buffer_ = theBufferList().first(); } else { + //FIXME 3440 + // last_buffer = buffer_; // Set current buffer buffer_ = b; } @@ -200,14 +206,16 @@ anchor_ref_ = 0; offset_ref_ = 0; - if (buffer_) { + if (!buffer_) + return; + LYXERR(Debug::INFO) << BOOST_CURRENT_FUNCTION - << "Buffer addr: " << buffer_ << endl; + << "Buffer addr: " << buffer_ << endl; cursor_.push(buffer_->inset()); cursor_.resetAnchor(); buffer_->text().setCurrentFont(cursor_); if (buffer_->getCursor().size() > 0 && - buffer_->getAnchor().size() > 0) + buffer_->getAnchor().size() > 0) { cursor_.setCursor(buffer_->getAnchor().asDocIterator(&(buffer_->inset()))); cursor_.resetAnchor(); @@ -216,12 +224,8 @@ // do not set selection to the new buffer because we // only paste recent selection. } - } - - if (buffer_) updateMetrics(false); - - if (buffer_ && graphics::Previews::status() != LyXRC::PREVIEW_OFF) + if (graphics::Previews::status() != LyXRC::PREVIEW_OFF) graphics::Previews::get().generateBufferPreviews(*buffer_); }