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
This commit is contained in:
Pavel Sanda 2018-12-19 21:31:26 +01:00
parent af5909beac
commit 99bfe20120
2 changed files with 5 additions and 2 deletions

View 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);
}

View 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