loplugin:badstatics: further (Linux-only) static only found with libc++

Change-Id: I048212e3feb3f548d5a65940dd71ccb71cade778
This commit is contained in:
Stephan Bergmann
2016-06-30 12:53:40 +02:00
parent dc93e3330e
commit 2ea01fb900
2 changed files with 19 additions and 4 deletions

View File

@@ -148,6 +148,8 @@ public:
|| name == "theAddInAsyncTbl" || name == "theAddInAsyncTbl"
// sc/source/core/tool/adiasync.cxx, would leak // sc/source/core/tool/adiasync.cxx, would leak
// ScAddInAsync* keys if that set is not empty at exit // ScAddInAsync* keys if that set is not empty at exit
|| name == "g_aWindowList"
//vcl/unx/gtk/a11y/atkutil.cxx, asserted empty at exit
) // these variables appear unproblematic ) // these variables appear unproblematic
{ {
return true; return true;

View File

@@ -44,6 +44,7 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <config_version.h> #include <config_version.h>
#include <cassert>
#include <set> #include <set>
using namespace ::com::sun::star; using namespace ::com::sun::star;
@@ -483,7 +484,19 @@ static void handle_toolbox_buttonchange(VclWindowEvent const *pEvent)
/*****************************************************************************/ /*****************************************************************************/
static std::set< VclPtr<vcl::Window> > g_aWindowList; namespace {
struct WindowList {
~WindowList() { assert(list.empty()); };
// needs to be empty already on DeInitVCL, but at least check it's empty
// on exit
std::set< VclPtr<vcl::Window> > list;
};
WindowList g_aWindowList;
}
static void handle_get_focus(::VclWindowEvent const * pEvent) static void handle_get_focus(::VclWindowEvent const * pEvent)
{ {
@@ -534,9 +547,9 @@ static void handle_get_focus(::VclWindowEvent const * pEvent)
} }
else else
{ {
if( g_aWindowList.find(pWindow) == g_aWindowList.end() ) if( g_aWindowList.list.find(pWindow) == g_aWindowList.list.end() )
{ {
g_aWindowList.insert(pWindow); g_aWindowList.list.insert(pWindow);
try try
{ {
aDocumentFocusListener->attachRecursive(xAccessible, xContext, xStateSet); aDocumentFocusListener->attachRecursive(xAccessible, xContext, xStateSet);
@@ -628,7 +641,7 @@ void WindowEventHandler(void *, VclSimpleEvent& rEvent)
break; break;
case VCLEVENT_OBJECT_DYING: case VCLEVENT_OBJECT_DYING:
g_aWindowList.erase( static_cast< ::VclWindowEvent const * >(&rEvent)->GetWindow() ); g_aWindowList.list.erase( static_cast< ::VclWindowEvent const * >(&rEvent)->GetWindow() );
SAL_FALLTHROUGH; SAL_FALLTHROUGH;
case VCLEVENT_TOOLBOX_HIGHLIGHTOFF: case VCLEVENT_TOOLBOX_HIGHLIGHTOFF:
handle_toolbox_highlightoff(static_cast< ::VclWindowEvent const * >(&rEvent)->GetWindow()); handle_toolbox_highlightoff(static_cast< ::VclWindowEvent const * >(&rEvent)->GetWindow());