diff options
author | Noel Grandin <noel@peralex.com> | 2016-04-14 15:07:57 +0200 |
---|---|---|
committer | Björn Michaelsen <bjoern.michaelsen@canonical.com> | 2016-04-15 12:09:05 +0000 |
commit | 4ff087565baf6e540667494a7fe3a229d66b1886 (patch) | |
tree | 69c4af9240b78150f85d695471899dd8b069c7da /compilerplugins | |
parent | 7ac9973da65d80832069afa76fd7325cf53c9293 (diff) |
update badstatics plugin to look for VclPtr<> statics
maybe we should create a "StaticVclPtr<>" class that checks if VCL is
still "alive" before destructing the object?
Change-Id: If8619f689c29294efa19c37ec782fa07acec728d
Reviewed-on: https://gerrit.libreoffice.org/24085
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Michael Meeks <michael.meeks@collabora.com>
Reviewed-by: Björn Michaelsen <bjoern.michaelsen@canonical.com>
Diffstat (limited to 'compilerplugins')
-rw-r--r-- | compilerplugins/clang/badstatics.cxx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/compilerplugins/clang/badstatics.cxx b/compilerplugins/clang/badstatics.cxx index 46590e5f1612..ecc930093a3a 100644 --- a/compilerplugins/clang/badstatics.cxx +++ b/compilerplugins/clang/badstatics.cxx @@ -51,6 +51,7 @@ public: if ( type.Class("Image").GlobalNamespace() || type.Class("Bitmap").GlobalNamespace() || type.Class("BitmapEx").GlobalNamespace() + || type.Class("VclPtr").GlobalNamespace() ) { return std::make_pair(true, chain); @@ -145,6 +146,22 @@ public: { return true; } + // TODO: check these VclPtr<> static fields + if ( name == "xPreviousWindow" // vcl/source/window/winproc.cxx + || name == "vDev" // sdext/source/pdfimport/wrapper/wrapper.cxx + || name == "s_xEmptyController" // svx/source/fmcomp/gridcell.cxx + || name == "xCell" // svx/source/table/svdotable.cxx + || name == "pPixOut" // sw/source/core/txtnode/fntcache.cxx + || name == "mpCareWindow" // sw/source/core/view/viewsh.cxx + ) + { + return true; + } + // ignore pointers, nothing happens to them on shutdown + QualType const pCanonical(pVarDecl->getType().getUnqualifiedType().getCanonicalType()); + if (pCanonical->isPointerType()) { + return true; + } std::vector<FieldDecl const*> pad; auto const ret(isBadStaticType(pVarDecl->getType(), pad, std::vector<QualType>())); |