[Libreoffice-commits] core.git: compilerplugins/clang vcl/unx

Stephan Bergmann sbergman at redhat.com
Thu Jun 30 10:54:09 UTC 2016


 compilerplugins/clang/badstatics.cxx |    2 ++
 vcl/unx/gtk/a11y/atkutil.cxx         |   21 +++++++++++++++++----
 2 files changed, 19 insertions(+), 4 deletions(-)

New commits:
commit 2ea01fb9002c4aceba724cabad663d6026381c0c
Author: Stephan Bergmann <sbergman at redhat.com>
Date:   Thu Jun 30 12:53:40 2016 +0200

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

diff --git a/compilerplugins/clang/badstatics.cxx b/compilerplugins/clang/badstatics.cxx
index 4904e1a..12e6b93 100644
--- a/compilerplugins/clang/badstatics.cxx
+++ b/compilerplugins/clang/badstatics.cxx
@@ -148,6 +148,8 @@ public:
                 || name == "theAddInAsyncTbl"
                     // sc/source/core/tool/adiasync.cxx, would leak
                     // 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
             {
                 return true;
diff --git a/vcl/unx/gtk/a11y/atkutil.cxx b/vcl/unx/gtk/a11y/atkutil.cxx
index d722936..79d8013 100644
--- a/vcl/unx/gtk/a11y/atkutil.cxx
+++ b/vcl/unx/gtk/a11y/atkutil.cxx
@@ -44,6 +44,7 @@
 #include <gtk/gtk.h>
 #include <config_version.h>
 
+#include <cassert>
 #include <set>
 
 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)
 {
@@ -534,9 +547,9 @@ static void handle_get_focus(::VclWindowEvent const * pEvent)
     }
     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
             {
                 aDocumentFocusListener->attachRecursive(xAccessible, xContext, xStateSet);
@@ -628,7 +641,7 @@ void WindowEventHandler(void *, VclSimpleEvent& rEvent)
             break;
 
         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;
         case VCLEVENT_TOOLBOX_HIGHLIGHTOFF:
             handle_toolbox_highlightoff(static_cast< ::VclWindowEvent const * >(&rEvent)->GetWindow());


More information about the Libreoffice-commits mailing list