diff options
author | David Tardon <dtardon@redhat.com> | 2016-05-06 09:18:58 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2016-05-06 09:23:45 +0200 |
commit | fe4ac23ed8054a8e863d911c6fb0a38c4449672a (patch) | |
tree | b46facaaf1c4152bfe04124e933beea631473708 | |
parent | 1aeca4b64aac45e64eaab32a0726850ff30dea31 (diff) |
tdf#99703 Revert "improve perf. of VCL event dispatch"
... as it causes a crash at exit.
This reverts commit 9ff1d7f8140de1224bb37fba0cb266a58f37e66d.
Change-Id: I48bfd8974e6ed6c5ba3f8282eb8717f685d580be
-rw-r--r-- | vcl/inc/window.h | 2 | ||||
-rw-r--r-- | vcl/source/window/event.cxx | 13 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 1 |
3 files changed, 1 insertions, 15 deletions
diff --git a/vcl/inc/window.h b/vcl/inc/window.h index 302e9d03541b..e06a6b1d07c9 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 0a7f04c27f34..10a85ed368db 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 d1c1ffe0dc49..f245c475ee7b 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 |