Kaydet (Commit) 027c8369 authored tarafından Caolán McNamara's avatar Caolán McNamara

Resolves: rhbz#1338546 use-after-delete of WindowImpl

Change-Id: I528aacd042ff17e6f6cdcd434d1c790b2139928e
üst 5c5209c2
......@@ -220,11 +220,14 @@ void Window::CallEventListeners( sal_uLong nEvent, void* pData )
mpWindowImpl->mnEventListenersIteratingCount++;
auto& rWindowImpl = *mpWindowImpl;
comphelper::ScopeGuard aGuard(
[&rWindowImpl]()
[&rWindowImpl, &xWindow]()
{
rWindowImpl.mnEventListenersIteratingCount--;
if (rWindowImpl.mnEventListenersIteratingCount == 0)
rWindowImpl.maEventListenersDeleted.clear();
if (!xWindow->IsDisposed())
{
rWindowImpl.mnEventListenersIteratingCount--;
if (rWindowImpl.mnEventListenersIteratingCount == 0)
rWindowImpl.maEventListenersDeleted.clear();
}
}
);
for ( Link<VclWindowEvent&,void>& rLink : aCopy )
......@@ -250,11 +253,14 @@ void Window::CallEventListeners( sal_uLong nEvent, void* pData )
// we use an iterating counter/flag and a set of deleted Link's to avoid O(n^2) behaviour
rWindowImpl.mnChildEventListenersIteratingCount++;
comphelper::ScopeGuard aGuard(
[&rWindowImpl]()
[&rWindowImpl, &xWindow]()
{
rWindowImpl.mnChildEventListenersIteratingCount--;
if (rWindowImpl.mnChildEventListenersIteratingCount == 0)
rWindowImpl.maChildEventListenersDeleted.clear();
if (!xWindow->IsDisposed())
{
rWindowImpl.mnChildEventListenersIteratingCount--;
if (rWindowImpl.mnChildEventListenersIteratingCount == 0)
rWindowImpl.maChildEventListenersDeleted.clear();
}
}
);
for ( Link<VclWindowEvent&,void>& rLink : aCopy )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment