summaryrefslogtreecommitdiff
path: root/vcl/source/window
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2015-09-21 08:03:25 +0200
committerNoel Grandin <noel@peralex.com>2015-09-21 08:03:52 +0200
commit1e67e94f1a308ca60d4934e9fe9d5c048225ebe8 (patch)
treec3bdf0fcec6912bc84e835fe48a80ee9f9391106 /vcl/source/window
parentc916152d8562cab868d4c522748ac30029fad179 (diff)
convert Link<> to typed
Change-Id: If3e2b00092440ebd42ae5b73ae2b0e44c3702683
Diffstat (limited to 'vcl/source/window')
-rw-r--r--vcl/source/window/event.cxx29
1 files changed, 22 insertions, 7 deletions
diff --git a/vcl/source/window/event.cxx b/vcl/source/window/event.cxx
index 20ee6164abbb..fbbf24532ac7 100644
--- a/vcl/source/window/event.cxx
+++ b/vcl/source/window/event.cxx
@@ -214,8 +214,8 @@ void Window::CallEventListeners( sal_uLong nEvent, void* pData )
if (!mpWindowImpl->maEventListeners.empty())
{
- // Copy the list, because this can be destroyed when calling a Link...
- std::vector<Link<VclWindowEvent&,void>> aCopy( mpWindowImpl->maEventListeners );
+ // Copy the list, because this can be destroyed when calling a Link...
+ std::vector<Link<VclWindowEvent&,void>> aCopy( mpWindowImpl->maEventListeners );
for ( Link<VclWindowEvent&,void>& rLink : aCopy )
{
if (aDelData.IsDead()) break;
@@ -238,7 +238,19 @@ void Window::CallEventListeners( sal_uLong nEvent, void* pData )
if ( aDelData.IsDead() )
return;
- pWindow->mpWindowImpl->maChildEventListeners.Call( &aEvent );
+ if (!mpWindowImpl->maEventListeners.empty())
+ {
+ // Copy the list, because this can be destroyed when calling a Link...
+ std::vector<Link<VclWindowEvent&,void>> aCopy( mpWindowImpl->maChildEventListeners );
+ for ( Link<VclWindowEvent&,void>& rLink : aCopy )
+ {
+ if (aDelData.IsDead())
+ return;
+ // check this hasn't been removed in some re-enterancy scenario fdo#47368
+ if( std::find(mpWindowImpl->maChildEventListeners.begin(), mpWindowImpl->maChildEventListeners.end(), rLink) != mpWindowImpl->maChildEventListeners.end() )
+ rLink.Call( aEvent );
+ }
+ }
if ( aDelData.IsDead() )
return;
@@ -268,15 +280,18 @@ void Window::RemoveEventListener( const Link<VclWindowEvent&,void>& rEventListen
}
}
-void Window::AddChildEventListener( const Link<>& rEventListener )
+void Window::AddChildEventListener( const Link<VclWindowEvent&,void>& rEventListener )
{
- mpWindowImpl->maChildEventListeners.addListener( rEventListener );
+ mpWindowImpl->maChildEventListeners.push_back( rEventListener );
}
-void Window::RemoveChildEventListener( const Link<>& rEventListener )
+void Window::RemoveChildEventListener( const Link<VclWindowEvent&,void>& rEventListener )
{
if (mpWindowImpl)
- mpWindowImpl->maChildEventListeners.removeListener( rEventListener );
+ {
+ auto& rListeners = mpWindowImpl->maChildEventListeners;
+ rListeners.erase( std::remove(rListeners.begin(), rListeners.end(), rEventListener ), rListeners.end() );
+ }
}
ImplSVEvent * Window::PostUserEvent( const Link<void*,void>& rLink, void* pCaller, bool bReferenceLink )