]> git.lyx.org Git - lyx.git/blobdiff - src/insets/InsetBibitem.cpp
The last commit was, uhh, not what I intended.
[lyx.git] / src / insets / InsetBibitem.cpp
index 2eec3310e38ffa740af5ba7375c1ef9bd8c7cb3e..1f5b9159483bd406a7d73a692cb7505d727b89c3 100644 (file)
 
 #include "frontends/alert.h"
 
-#include "support/lstrings.h"
+#include "support/convert.h"
 #include "support/docstream.h"
 #include "support/gettext.h"
-#include "support/convert.h"
+#include "support/lstrings.h"
 
 using namespace std;
 using namespace lyx::support;
@@ -57,7 +57,7 @@ InsetBibitem::InsetBibitem(Buffer const & buf, InsetCommandParams const & p)
 
 InsetBibitem::~InsetBibitem()
 {
-       if (buffer_)
+       if (isBufferValid())
                buffer_->invalidateBibinfoCache();
 }
 
@@ -116,12 +116,14 @@ void InsetBibitem::doDispatch(Cursor & cur, FuncRequest & cmd)
                        cur.noUpdate();
                        break;
                }
-               docstring old_key = params()["key"];
+               docstring const & old_key = params()["key"];
                setParam("label", p["label"]);
-               updateCommand(p["key"]);
-               if (params()["key"] != old_key)
+               if (p["key"] != old_key) {
+                       updateCommand(p["key"]);
                        cur.bv().buffer().changeRefsIfUnique(old_key,
                                params()["key"], CITE_CODE);
+               }
+               buffer_->invalidateBibinfoCache();
                break;
        }