Simplify dynamic_cast followed by a static_cast.
Change-Id: Iec55b1d2e290e2bcc0286225b6f731314f058625
diff --git a/vcl/source/app/vclevent.cxx b/vcl/source/app/vclevent.cxx
index da87732..4786fd6 100644
--- a/vcl/source/app/vclevent.cxx
+++ b/vcl/source/app/vclevent.cxx
@@ -49,9 +49,9 @@ void VclEventListeners::Call( VclSimpleEvent& rEvent ) const
std::vector<Link<VclSimpleEvent&,void>> aCopy( m_aListeners );
std::vector<Link<VclSimpleEvent&,void>>::iterator aIter( aCopy.begin() );
std::vector<Link<VclSimpleEvent&,void>>::const_iterator aEnd( aCopy.end() );
if( dynamic_cast<const VclWindowEvent*>( &rEvent ) != nullptr )
if (VclWindowEvent* pWindowEvent = dynamic_cast<VclWindowEvent*>(&rEvent))
{
VclPtr<vcl::Window> xWin((static_cast<VclWindowEvent*>(&rEvent))->GetWindow());
VclPtr<vcl::Window> xWin(pWindowEvent->GetWindow());
while ( aIter != aEnd && xWin && ! xWin->IsDisposed() )
{
Link<VclSimpleEvent&,void> &rLink = *aIter;