From 0a3deeded1248d876aff65105c64fb21cc8c9035 Mon Sep 17 00:00:00 2001 From: Pavel Sanda Date: Wed, 19 Dec 2018 21:31:26 +0100 Subject: [PATCH] Properly clean cache which binds inset and dialog. 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 | 5 ++++- src/frontends/qt4/GuiView.cpp | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/BufferView.cpp b/src/BufferView.cpp index 95024f5bb6..e2648a151c 100644 --- a/src/BufferView.cpp +++ b/src/BufferView.cpp @@ -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); } diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp index 9d5f5dca6a..4c87499a4d 100644 --- a/src/frontends/qt4/GuiView.cpp +++ b/src/frontends/qt4/GuiView.cpp @@ -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 -- 2.39.5