From: Pavel Sanda Date: Wed, 19 Dec 2018 20:31:26 +0000 (+0100) Subject: Properly clean cache which binds inset and dialog. X-Git-Tag: lyx-2.4.0dev-acb2ca7b~2858 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=99bfe201208a5cb4553cb88d0633ebc1c64b828c;p=features.git 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 --- 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