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

David Tardon dtardon at redhat.com
Fri May 6 07:26:23 UTC 2016


 vcl/inc/window.h             |    2 --
 vcl/source/window/event.cxx  |   13 +------------
 vcl/source/window/window.cxx |    1 -
 3 files changed, 1 insertion(+), 15 deletions(-)

New commits:
commit fe4ac23ed8054a8e863d911c6fb0a38c4449672a
Author: David Tardon <dtardon at redhat.com>
Date:   Fri May 6 09:18:58 2016 +0200

    tdf#99703 Revert "improve perf. of VCL event dispatch"
    
    ... as it causes a crash at exit.
    
    This reverts commit 9ff1d7f8140de1224bb37fba0cb266a58f37e66d.
    
    Change-Id: I48bfd8974e6ed6c5ba3f8282eb8717f685d580be

diff --git a/vcl/inc/window.h b/vcl/inc/window.h
index 302e9d0..e06a6b1 100644
--- a/vcl/inc/window.h
+++ b/vcl/inc/window.h
@@ -201,8 +201,6 @@ public:
     VclPtr<vcl::Window> mpLastFocusWindow;
     VclPtr<vcl::Window> mpDlgCtrlDownWindow;
     std::vector<Link<VclWindowEvent&,void>> maEventListeners;
-    int mnEventListenersIteratingCount;
-    std::set<Link<VclWindowEvent&,void>> maEventListenersDeleted;
     std::vector<Link<VclWindowEvent&,void>> maChildEventListeners;
     int mnChildEventListenersIteratingCount;
     std::set<Link<VclWindowEvent&,void>> maChildEventListenersDeleted;
diff --git a/vcl/source/window/event.cxx b/vcl/source/window/event.cxx
index 0a7f04c..10a85ed 100644
--- a/vcl/source/window/event.cxx
+++ b/vcl/source/window/event.cxx
@@ -216,22 +216,11 @@ void Window::CallEventListeners( sal_uLong nEvent, void* pData )
     {
         // Copy the list, because this can be destroyed when calling a Link...
         std::vector<Link<VclWindowEvent&,void>> aCopy( mpWindowImpl->maEventListeners );
-        // we use an iterating counter/flag and a set of deleted Link's to avoid O(n^2) behaviour
-        mpWindowImpl->mnEventListenersIteratingCount++;
-        auto& rWindowImpl = *mpWindowImpl;
-        comphelper::ScopeGuard aGuard(
-            [&rWindowImpl]()
-            {
-                rWindowImpl.mnEventListenersIteratingCount--;
-                if (rWindowImpl.mnEventListenersIteratingCount == 0)
-                    rWindowImpl.maEventListenersDeleted.clear();
-            }
-        );
         for ( Link<VclWindowEvent&,void>& rLink : aCopy )
         {
             if (xWindow->IsDisposed()) break;
             // check this hasn't been removed in some re-enterancy scenario fdo#47368
-            if( rWindowImpl.maEventListenersDeleted.find(rLink) == rWindowImpl.maEventListenersDeleted.end() )
+            if( std::find(mpWindowImpl->maEventListeners.begin(), mpWindowImpl->maEventListeners.end(), rLink) != mpWindowImpl->maEventListeners.end() )
                 rLink.Call( aEvent );
         }
     }
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index d1c1ffe..f245c47 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -615,7 +615,6 @@ WindowImpl::WindowImpl( WindowType nType )
     mpNextOverlap                       = nullptr;                      // next overlap window of frame
     mpLastFocusWindow                   = nullptr;                      // window for focus restore
     mpDlgCtrlDownWindow                 = nullptr;                      // window for dialog control
-    mnEventListenersIteratingCount = 0;
     mnChildEventListenersIteratingCount = 0;
     mpUserData                          = nullptr;                      // user data
     mpCursor                            = nullptr;                      // cursor


More information about the Libreoffice-commits mailing list