commit 99bfe201208a5cb4553cb88d0633ebc1c64b828c
Author: Pavel Sanda <sa...@lyx.org>
Date:   Wed Dec 19 21:31:26 2018 +0100

    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 95024f5..e2648a1 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 9d5f5dc..4c87499 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

Reply via email to