[Libreoffice-commits] core.git: vcl/inc vcl/source

Jan-Marek Glogowski glogow at fbihome.de
Mon Oct 2 17:58:24 UTC 2017


 vcl/inc/salusereventlist.hxx        |    2 ++
 vcl/source/app/salusereventlist.cxx |   17 ++++++++++++-----
 2 files changed, 14 insertions(+), 5 deletions(-)

New commits:
commit 9fc7fb0e78334b926347d85480ad9df00cc1ed1e
Author: Jan-Marek Glogowski <glogow at fbihome.de>
Date:   Mon Oct 2 14:41:17 2017 +0200

    tdf#112769 Don't multi-trigger AllEventsProcessed
    
    User events processing - as all event processing - can be nested,
    which can cause TriggerAllUserEventsProcessed to be called multiple
    times, when a nested event loops ends.
    
    So track TriggerAllUserEventsProcessed calls and just reset, if
    a new event was inserted.
    
    Change-Id: I4a1b1b08901c99a7ece08f8baf008c8bb73506bf
    Reviewed-on: https://gerrit.libreoffice.org/43043
    Reviewed-by: Eike Rathke <erack at redhat.com>
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Jan-Marek Glogowski <glogow at fbihome.de>

diff --git a/vcl/inc/salusereventlist.hxx b/vcl/inc/salusereventlist.hxx
index 1f689fb5cbf7..99b32c515f95 100644
--- a/vcl/inc/salusereventlist.hxx
+++ b/vcl/inc/salusereventlist.hxx
@@ -67,6 +67,7 @@ protected:
     mutable osl::Mutex         m_aUserEventsMutex;
     std::list< SalUserEvent >  m_aUserEvents;
     std::list< SalUserEvent >  m_aProcessingUserEvents;
+    bool                       m_bAllUserEventProcessedSignaled;
     SalFrameSet                m_aFrames;
 
     virtual void ProcessEvent( SalUserEvent aEvent ) = 0;
@@ -113,6 +114,7 @@ inline void SalUserEventList::PostEvent( SalFrame* pFrame, void* pData, SalEvent
 {
     osl::MutexGuard aGuard( m_aUserEventsMutex );
     m_aUserEvents.push_back( SalUserEvent( pFrame, pData, nEvent ) );
+    m_bAllUserEventProcessedSignaled = false;
     TriggerUserEventProcessing();
 }
 
diff --git a/vcl/source/app/salusereventlist.cxx b/vcl/source/app/salusereventlist.cxx
index af588e4bb151..6384d8805be4 100644
--- a/vcl/source/app/salusereventlist.cxx
+++ b/vcl/source/app/salusereventlist.cxx
@@ -23,6 +23,7 @@
 #include <algorithm>
 
 SalUserEventList::SalUserEventList()
+    : m_bAllUserEventProcessedSignaled( false )
 {
 }
 
@@ -79,11 +80,14 @@ bool SalUserEventList::DispatchUserEvents( bool bHandleAllCurrentEvents )
                 ProcessEvent( aEvent );
         }
         while( true );
-    }
 
-    osl::MutexGuard aGuard( m_aUserEventsMutex );
-    if ( !HasUserEvents() )
-        TriggerAllUserEventsProcessed();
+        osl::MutexGuard aGuard( m_aUserEventsMutex );
+        if ( !m_bAllUserEventProcessedSignaled && !HasUserEvents() )
+        {
+            m_bAllUserEventProcessedSignaled = true;
+            TriggerAllUserEventsProcessed();
+        }
+    }
 
     return bWasEvent;
 }
@@ -110,8 +114,11 @@ bool SalUserEventList::RemoveEvent( SalFrame* pFrame, void* pData, SalEvent nEve
         }
     }
 
-    if ( bResult && !HasUserEvents() )
+    if ( bResult && !m_bAllUserEventProcessedSignaled && !HasUserEvents() )
+    {
+        m_bAllUserEventProcessedSignaled = true;
         TriggerAllUserEventsProcessed();
+    }
 
     return bResult;
 }


More information about the Libreoffice-commits mailing list