[Libreoffice-commits] core.git: Branch 'libreoffice-6-4' - basctl/source

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Thu May 21 11:28:59 UTC 2020


 basctl/source/basicide/baside2.hxx  |    3 +++
 basctl/source/basicide/baside2b.cxx |   19 ++++++++++++++++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

New commits:
commit 1f628d9e1b118741093c0748686bd71223ef2364
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Tue May 19 11:20:52 2020 +0100
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Thu May 21 13:28:28 2020 +0200

    Resolves: tdf#114258 defer LoseFocus treeview update
    
    until the next event cycle in cas the LoseFocus is happening due to an
    in-progress selection event from a  mouse down in the treeview that would be
    updated
    
    Change-Id: Ia4448aa798a8af7cd35bc17215891f6c5ca8678a
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94494
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    (cherry picked from commit 1f209723cb294559f6f6bbb42d9db7b78a3b5a61)
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94455

diff --git a/basctl/source/basicide/baside2.hxx b/basctl/source/basicide/baside2.hxx
index 81401763c9ae..ba9f5b43f0fb 100644
--- a/basctl/source/basicide/baside2.hxx
+++ b/basctl/source/basicide/baside2.hxx
@@ -85,10 +85,13 @@ private:
 
     long            nCurTextWidth;
 
+    ImplSVEvent* m_nSetSourceInBasicId;
+
     SyntaxHighlighter   aHighlighter;
     Idle                aSyntaxIdle;
     std::set<sal_uInt16>       aSyntaxLineTable;
     DECL_LINK(SyntaxTimerHdl, Timer *, void);
+    DECL_LINK(SetSourceInBasicHdl, void*, void);
 
     // progress bar
     class ProgressInfo;
diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx
index 6bf425a65c8b..d07222a44d27 100644
--- a/basctl/source/basicide/baside2b.cxx
+++ b/basctl/source/basicide/baside2b.cxx
@@ -229,6 +229,7 @@ EditorWindow::EditorWindow (vcl::Window* pParent, ModulWindow* pModulWindow) :
     Window(pParent, WB_BORDER),
     rModulWindow(*pModulWindow),
     nCurTextWidth(0),
+    m_nSetSourceInBasicId(nullptr),
     aHighlighter(HighlighterLanguage::Basic),
     bHighlighting(false),
     bDoSyntaxHighlight(true),
@@ -259,6 +260,12 @@ EditorWindow::~EditorWindow()
 
 void EditorWindow::dispose()
 {
+    if (m_nSetSourceInBasicId)
+    {
+        Application::RemoveUserEvent(m_nSetSourceInBasicId);
+        m_nSetSourceInBasicId = nullptr;
+    }
+
     Reference< beans::XMultiPropertySet > n;
     {
         osl::MutexGuard g(mutex_);
@@ -926,10 +933,20 @@ void EditorWindow::Paint(vcl::RenderContext& rRenderContext, const tools::Rectan
 
 void EditorWindow::LoseFocus()
 {
-    SetSourceInBasic();
+    // tdf#114258 wait until the next event loop cycle to do this so it doesn't
+    // happen during a mouse down/up selection in the treeview whose contents
+    // this may update
+    if (!m_nSetSourceInBasicId)
+        m_nSetSourceInBasicId = Application::PostUserEvent(LINK(this, EditorWindow, SetSourceInBasicHdl));
     Window::LoseFocus();
 }
 
+IMPL_LINK_NOARG(EditorWindow, SetSourceInBasicHdl, void*, void)
+{
+    m_nSetSourceInBasicId = nullptr;
+    SetSourceInBasic();
+}
+
 void EditorWindow::SetSourceInBasic()
 {
     if ( pEditEngine && pEditEngine->IsModified()


More information about the Libreoffice-commits mailing list