On Sat, 2008-10-25 at 14:55 +0200, Vincent van Ravesteijn wrote: > Hi all, > > A. > 1. create a new document (doc1), > 2. insert a label, > 3. insert a cross-ref > 4. create a new document (doc2) > 5. insert a cross-ref (in doc2) > then the labels in the cross-ref dialog are those from doc1. >
This is solved by the attached patch. We should not restore the last used buffer if the active buffer has changed. Especially not when you cannot choose the buffer which is now still the case. Vincent
Index: src/frontends/qt4/GuiRef.cpp =================================================================== --- src/frontends/qt4/GuiRef.cpp (revision 27134) +++ src/frontends/qt4/GuiRef.cpp (working copy) @@ -96,6 +96,7 @@ bc().addReadOnly(bufferCO); restored_buffer_ = -1; + active_buffer_ = -1; } @@ -230,14 +231,18 @@ bufferCO->addItem(toqstr(makeDisplayPath(it->absFilename()))); } + int thebuffer = theBufferList().bufferNum(buffer().fileName()); // restore the buffer combo setting for new insets if (params_["reference"].empty() && restored_buffer_ != -1 - && restored_buffer_ < bufferCO->count()) + && restored_buffer_ < bufferCO->count() && thebuffer == active_buffer_) bufferCO->setCurrentIndex(restored_buffer_); else { int num = theBufferList().bufferNum(buffer().fileName()); bufferCO->setCurrentIndex(num); + if (thebuffer != active_buffer_) + restored_buffer_ = num; } + active_buffer_ = thebuffer; updateRefs(); bc().setValid(false); Index: src/frontends/qt4/GuiRef.h =================================================================== --- src/frontends/qt4/GuiRef.h (revision 27134) +++ src/frontends/qt4/GuiRef.h (working copy) @@ -94,6 +94,8 @@ QString last_reference_; /// store the buffer settings int restored_buffer_; + /// store the last active buffer + int active_buffer_; /// the references std::vector<docstring> refs_; };