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

coverity#1028600 Uninitialized scalar field

Change-Id: I0b4ee14ea2306786351ce20960a05e8f3058fb21
üst e32fd5e8
...@@ -232,7 +232,7 @@ public: ...@@ -232,7 +232,7 @@ public:
VclPtr<vcl::Window> mpDlgCtrlDownWindow; VclPtr<vcl::Window> mpDlgCtrlDownWindow;
std::vector<Link<VclWindowEvent&,void>> maEventListeners; std::vector<Link<VclWindowEvent&,void>> maEventListeners;
std::vector<Link<VclWindowEvent&,void>> maChildEventListeners; std::vector<Link<VclWindowEvent&,void>> maChildEventListeners;
int maChildEventListenersIteratingCount; int mnChildEventListenersIteratingCount;
std::set<Link<VclWindowEvent&,void>> maChildEventListenersDeleted; std::set<Link<VclWindowEvent&,void>> maChildEventListenersDeleted;
// The canvas interface for this VCL window. Is persistent after the first GetCanvas() call // The canvas interface for this VCL window. Is persistent after the first GetCanvas() call
......
...@@ -245,11 +245,11 @@ void Window::CallEventListeners( sal_uLong nEvent, void* pData ) ...@@ -245,11 +245,11 @@ void Window::CallEventListeners( sal_uLong nEvent, void* pData )
// Copy the list, because this can be destroyed when calling a Link... // Copy the list, because this can be destroyed when calling a Link...
std::vector<Link<VclWindowEvent&,void>> aCopy( rWindowImpl.maChildEventListeners ); std::vector<Link<VclWindowEvent&,void>> aCopy( rWindowImpl.maChildEventListeners );
// we use an iterating counter/flag and a set of deleted Link's to avoid O(n^2) behaviour // we use an iterating counter/flag and a set of deleted Link's to avoid O(n^2) behaviour
rWindowImpl.maChildEventListenersIteratingCount++; rWindowImpl.mnChildEventListenersIteratingCount++;
comphelper::ScopeGuard aGuard( comphelper::ScopeGuard aGuard(
[&rWindowImpl]() [&rWindowImpl]()
{ {
if (--rWindowImpl.maChildEventListenersIteratingCount == 0) if (--rWindowImpl.mnChildEventListenersIteratingCount == 0)
rWindowImpl.maChildEventListenersDeleted.clear(); rWindowImpl.maChildEventListenersDeleted.clear();
} }
); );
...@@ -302,7 +302,7 @@ void Window::RemoveChildEventListener( const Link<VclWindowEvent&,void>& rEventL ...@@ -302,7 +302,7 @@ void Window::RemoveChildEventListener( const Link<VclWindowEvent&,void>& rEventL
{ {
auto& rListeners = mpWindowImpl->maChildEventListeners; auto& rListeners = mpWindowImpl->maChildEventListeners;
rListeners.erase( std::remove(rListeners.begin(), rListeners.end(), rEventListener ), rListeners.end() ); rListeners.erase( std::remove(rListeners.begin(), rListeners.end(), rEventListener ), rListeners.end() );
if (mpWindowImpl->maChildEventListenersIteratingCount) if (mpWindowImpl->mnChildEventListenersIteratingCount)
mpWindowImpl->maChildEventListenersDeleted.insert(rEventListener); mpWindowImpl->maChildEventListenersDeleted.insert(rEventListener);
} }
} }
......
...@@ -631,6 +631,7 @@ WindowImpl::WindowImpl( WindowType nType ) ...@@ -631,6 +631,7 @@ WindowImpl::WindowImpl( WindowType nType )
mpNextOverlap = nullptr; // next overlap window of frame mpNextOverlap = nullptr; // next overlap window of frame
mpLastFocusWindow = nullptr; // window for focus restore mpLastFocusWindow = nullptr; // window for focus restore
mpDlgCtrlDownWindow = nullptr; // window for dialog control mpDlgCtrlDownWindow = nullptr; // window for dialog control
mnChildEventListenersIteratingCount = 0;
mpFirstDel = nullptr; // Dtor notification list mpFirstDel = nullptr; // Dtor notification list
mpUserData = nullptr; // user data mpUserData = nullptr; // user data
mpCursor = nullptr; // cursor mpCursor = nullptr; // cursor
......
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