]> git.lyx.org Git - features.git/commitdiff
Properly clean cache which binds inset and dialog.
authorPavel Sanda <sanda@lyx.org>
Wed, 19 Dec 2018 20:31:26 +0000 (21:31 +0100)
committerPavel Sanda <sanda@lyx.org>
Wed, 19 Dec 2018 20:31:26 +0000 (21:31 +0100)
We fill up edited insets into cache when editing inset is triggered, but
this cache is never cleared up for dialogs unassociated with some inset
- thus when e.g. graphics dialog is open for completely new image the
old cache is (wrongly) used.

https://www.mail-archive.com/lyx-devel@lists.lyx.org/msg207192.html

src/BufferView.cpp
src/frontends/qt4/GuiView.cpp

index 95024f5bb6b1bb7a99f8840aeb41fe77e0bee8e6..e2648a151ca6179848bbfabee257803977c6d381 100644 (file)
@@ -1264,7 +1264,10 @@ Inset * BufferView::editedInset(string const & name) const
 
 void BufferView::editInset(string const & name, Inset * inset)
 {
-       d->edited_insets_[name] = inset;
+       if (inset)
+               d->edited_insets_[name] = inset;
+       else
+               d->edited_insets_.erase(name);
 }
 
 
index 9d5f5dca6a43a98b726d6062bb4466324085bf0a..4c87499a4de91df230e6f92dda9026c4cc388481 100644 (file)
@@ -4623,7 +4623,7 @@ void GuiView::doShowDialog(QString const & qname, QString const & qdata,
                if (dialog) {
                        bool const visible = dialog->isVisibleView();
                        dialog->showData(sdata);
-                       if (inset && currentBufferView())
+                       if (currentBufferView())
                                currentBufferView()->editInset(name, inset);
                        // We only set the focus to the new dialog if it was not yet
                        // visible in order not to change the existing previous behaviour