diff options
38 files changed, 100 insertions, 97 deletions
diff --git a/compilerplugins/clang/badstatics.cxx b/compilerplugins/clang/badstatics.cxx index 1d003acdb8a6..3a69f78caef8 100644 --- a/compilerplugins/clang/badstatics.cxx +++ b/compilerplugins/clang/badstatics.cxx @@ -113,7 +113,7 @@ public: if (!pDefinition) { // maybe no definition if it's a pointer/reference return std::make_pair(false, std::vector<FieldDecl const*>()); } - if ( type.Class("DeleteOnDeinit").Namespace("vcl").GlobalNamespace() + if ( type.Class("DeleteOnDeinit").Namespace("tools").GlobalNamespace() || type.Class("weak_ptr").StdNamespace() // not owning || type.Class("ImplWallpaper").GlobalNamespace() // very odd static instance here || type.Class("Application").GlobalNamespace() // numerous odd subclasses in vclmain::createApplication() diff --git a/compilerplugins/clang/refcounting.cxx b/compilerplugins/clang/refcounting.cxx index 2bee2f80cf65..4140b6a10688 100644 --- a/compilerplugins/clang/refcounting.cxx +++ b/compilerplugins/clang/refcounting.cxx @@ -337,7 +337,7 @@ bool containsSalhelperReferenceObjectSubclass(const clang::Type* pType0) { if (dc.Class("Reference").Namespace("rtl").GlobalNamespace() || (dc.Class("OStoreHandle").AnonymousNamespace().Namespace("store") .GlobalNamespace()) - || (dc.Class("DeleteRtlReferenceOnDeinit").Namespace("vcl") + || (dc.Class("DeleteRtlReferenceOnDeinit").Namespace("tools") .GlobalNamespace())) { return false; diff --git a/connectivity/source/parse/sqlbison.y b/connectivity/source/parse/sqlbison.y index 23de1cb772ab..e9cd110c0f02 100644 --- a/connectivity/source/parse/sqlbison.y +++ b/connectivity/source/parse/sqlbison.y @@ -4505,7 +4505,7 @@ sal_Int32 OSQLParser::s_nRefCount = 0; // ::osl::Mutex OSQLParser::s_aMutex; OSQLScanner* OSQLParser::s_pScanner = nullptr; OSQLParseNodesGarbageCollector* OSQLParser::s_pGarbageCollector = nullptr; -vcl::DeleteOnDeinit<css::uno::Reference< css::i18n::XLocaleData4>> OSQLParser::s_xLocaleData(vcl::DeleteOnDeinitFlag::Empty); +tools::DeleteOnDeinit<css::uno::Reference< css::i18n::XLocaleData4>> OSQLParser::s_xLocaleData(tools::DeleteOnDeinitFlag::Empty); void setParser(OSQLParser* _pParser) { diff --git a/desktop/source/lib/lokclipboard.cxx b/desktop/source/lib/lokclipboard.cxx index 74374b95d66c..99f803523d40 100644 --- a/desktop/source/lib/lokclipboard.cxx +++ b/desktop/source/lib/lokclipboard.cxx @@ -9,7 +9,7 @@ #include "lokclipboard.hxx" #include <unordered_map> -#include <vcl/lazydelete.hxx> +#include <tools/lazydelete.hxx> #include <vcl/svapp.hxx> #include <sfx2/lokhelper.hxx> #include <sal/log.hxx> @@ -20,7 +20,7 @@ using namespace css; using namespace css::uno; /* static */ osl::Mutex LOKClipboardFactory::gMutex; -static vcl::DeleteOnDeinit<std::unordered_map<int, rtl::Reference<LOKClipboard>>> gClipboards{}; +static tools::DeleteOnDeinit<std::unordered_map<int, rtl::Reference<LOKClipboard>>> gClipboards{}; rtl::Reference<LOKClipboard> LOKClipboardFactory::getClipboardForCurView() { diff --git a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx index 28d383230eef..6b6499a8b539 100644 --- a/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx +++ b/drawinglayer/source/processor2d/vclhelperbufferdevice.cxx @@ -30,7 +30,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/matrix/b2dhommatrixtools.hxx> #include <vcl/timer.hxx> -#include <vcl/lazydelete.hxx> +#include <tools/lazydelete.hxx> #include <vcl/dibtools.hxx> #include <vcl/skia/SkiaHelper.hxx> #include <mutex> @@ -383,7 +383,7 @@ VDevBuffer& getVDevBuffer() // secure global instance with Vcl's safe destroyer of external (seen by // library base) stuff, the remembered VDevs need to be deleted before // Vcl's deinit - static vcl::DeleteOnDeinit<VDevBuffer> aVDevBuffer{}; + static tools::DeleteOnDeinit<VDevBuffer> aVDevBuffer{}; return *aVDevBuffer.get(); } diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx index a365beebae4d..45be8e0cc47e 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.cxx @@ -522,7 +522,7 @@ void VclMetafileProcessor2D::popList() } // init static break iterator -vcl::DeleteOnDeinit<uno::Reference<css::i18n::XBreakIterator>> +tools::DeleteOnDeinit<uno::Reference<css::i18n::XBreakIterator>> VclMetafileProcessor2D::mxBreakIterator; VclMetafileProcessor2D::VclMetafileProcessor2D(const geometry::ViewInformation2D& rViewInformation, diff --git a/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx b/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx index c315281ebf61..daad6d6e8dae 100644 --- a/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx +++ b/drawinglayer/source/processor2d/vclmetafileprocessor2d.hxx @@ -25,7 +25,7 @@ #include <com/sun/star/i18n/XBreakIterator.hpp> #include <basegfx/polygon/b2dpolypolygon.hxx> #include <vcl/pdfextoutdevdata.hxx> // vcl::PDFExtOutDevData support -#include <vcl/lazydelete.hxx> +#include <tools/lazydelete.hxx> class GDIMetaFile; namespace tools @@ -176,7 +176,7 @@ private: constructed VclMetafileProcessor2D. It's still incarnated on demand, but exists for OOo runtime now by purpose. */ - static vcl::DeleteOnDeinit<css::uno::Reference<css::i18n::XBreakIterator>> mxBreakIterator; + static tools::DeleteOnDeinit<css::uno::Reference<css::i18n::XBreakIterator>> mxBreakIterator; /* vcl::PDFExtOutDevData support For the first step, some extra actions at vcl::PDFExtOutDevData need to diff --git a/editeng/source/editeng/editeng.cxx b/editeng/source/editeng/editeng.cxx index 7feff6e8e6e0..fec2c8cd3c99 100644 --- a/editeng/source/editeng/editeng.cxx +++ b/editeng/source/editeng/editeng.cxx @@ -67,7 +67,7 @@ #include <rtl/strbuf.hxx> #include <sal/log.hxx> #include <vcl/help.hxx> -#include <vcl/lazydelete.hxx> +#include <tools/lazydelete.hxx> #include <vcl/transfer.hxx> #include <com/sun/star/datatransfer/clipboard/XClipboard.hpp> #include <com/sun/star/frame/Desktop.hpp> @@ -1714,7 +1714,7 @@ rtl::Reference<SfxItemPool> EditEngine::CreatePool() SfxItemPool& EditEngine::GetGlobalItemPool() { - static vcl::DeleteOnDeinit<rtl::Reference<SfxItemPool>> pGlobalPool(CreatePool()); + static tools::DeleteOnDeinit<rtl::Reference<SfxItemPool>> pGlobalPool(CreatePool()); return **pGlobalPool.get(); } diff --git a/editeng/source/editeng/eerdll.cxx b/editeng/source/editeng/eerdll.cxx index 732c85ee18cd..a50641ee1b0c 100644 --- a/editeng/source/editeng/eerdll.cxx +++ b/editeng/source/editeng/eerdll.cxx @@ -65,7 +65,7 @@ #include <editeng/forbiddencharacterstable.hxx> #include <editeng/justifyitem.hxx> #include <tools/mapunit.hxx> -#include <vcl/lazydelete.hxx> +#include <tools/lazydelete.hxx> #include <svl/itempool.hxx> #include <editeng/editids.hrc> @@ -78,7 +78,7 @@ EditDLL& EditDLL::Get() Previously this data was function-static, but then data in i18npool would be torn down before the destructor here ran, causing a crash. */ - static vcl::DeleteOnDeinit< EditDLL > gaEditDll; + static tools::DeleteOnDeinit< EditDLL > gaEditDll; return *gaEditDll.get(); } diff --git a/include/connectivity/sqlparse.hxx b/include/connectivity/sqlparse.hxx index 4ccd5ebbea95..43336b9628fb 100644 --- a/include/connectivity/sqlparse.hxx +++ b/include/connectivity/sqlparse.hxx @@ -25,7 +25,7 @@ #include <connectivity/dbtoolsdllapi.hxx> #include <connectivity/sqlerror.hxx> #include <comphelper/singletonref.hxx> -#include <vcl/lazydelete.hxx> +#include <tools/lazydelete.hxx> #include <map> #include <memory> @@ -140,7 +140,7 @@ namespace connectivity sal_Int32 m_nDateFormatKey; css::uno::Reference< css::uno::XComponentContext > m_xContext; css::uno::Reference< css::i18n::XCharacterClassification> m_xCharClass; - static vcl::DeleteOnDeinit<css::uno::Reference< css::i18n::XLocaleData4>> s_xLocaleData; + static tools::DeleteOnDeinit<css::uno::Reference< css::i18n::XLocaleData4>> s_xLocaleData; // convert a string into double trim it to scale of _nscale and then transform it back to string OUString stringToDouble(const OUString& _rValue,sal_Int16 _nScale); diff --git a/include/vcl/lazydelete.hxx b/include/tools/lazydelete.hxx index 9488030a3369..db820ec75d6e 100644 --- a/include/vcl/lazydelete.hxx +++ b/include/tools/lazydelete.hxx @@ -19,18 +19,18 @@ #pragma once -#include <vcl/dllapi.h> +#include <tools/toolsdllapi.h> #include <com/sun/star/lang/XComponent.hpp> #include <rtl/ref.hxx> #include <optional> -namespace vcl +namespace tools { /* - You may not access vcl objects after DeInitVCL has been called this includes their destruction - therefore disallowing the existence of static vcl object like e.g. a static BitmapEx + You may not access some objects after DeInitVCL has been called this includes their destruction + therefore disallowing the existence of static object like e.g. a static BitmapEx To work around this use DeleteOnDeinit<BitmapEx> which will allow you to have a static object container, that will have its contents destroyed on DeinitVCL. The single drawback is that you need to check on the container object whether it still contains content before actually accessing it. @@ -46,17 +46,17 @@ namespace vcl SomeWindow::Paint() { - static vcl::DeleteOnDeinit< BitmapEx > aBmp( ... ); + static tools::DeleteOnDeinit< BitmapEx > aBmp( ... ); if( aBmp.get() ) // check whether DeInitVCL has been called already DrawBitmapEx( Point( 10, 10 ), *aBmp ); } */ - class VCL_DLLPUBLIC DeleteOnDeinitBase + class TOOLS_DLLPUBLIC DeleteOnDeinitBase { public: - static void SAL_DLLPRIVATE ImplDeleteOnDeInit(); + static void ImplDeleteOnDeInit(); virtual ~DeleteOnDeinitBase(); protected: static void addDeinitContainer( DeleteOnDeinitBase* i_pContainer ); @@ -109,7 +109,7 @@ namespace vcl \<do something with xFactory> */ template <typename I> - class DeleteUnoReferenceOnDeinit final : public vcl::DeleteOnDeinitBase + class DeleteUnoReferenceOnDeinit final : public tools::DeleteOnDeinitBase { css::uno::Reference<I> m_xI; virtual void doCleanup() override { set(nullptr); } @@ -144,7 +144,7 @@ namespace vcl \<do something with xFactory> */ template <typename I> - class DeleteRtlReferenceOnDeinit final : public vcl::DeleteOnDeinitBase + class DeleteRtlReferenceOnDeinit final : public tools::DeleteOnDeinitBase { rtl::Reference<I> m_xI; virtual void doCleanup() override { set(nullptr); } diff --git a/include/vcl/glyphitemcache.hxx b/include/vcl/glyphitemcache.hxx index 373f270a65bc..4abcfb6e93c7 100644 --- a/include/vcl/glyphitemcache.hxx +++ b/include/vcl/glyphitemcache.hxx @@ -67,7 +67,7 @@ public: void SetCacheGlyphsWhenDoingFallbackFonts(bool bOK); static SalLayoutGlyphsCache* self(); - SalLayoutGlyphsCache(int size) // needs to be public for vcl::DeleteOnDeinit + SalLayoutGlyphsCache(int size) // needs to be public for tools::DeleteOnDeinit : mCachedGlyphs(size) { } diff --git a/sd/source/ui/view/viewoverlaymanager.cxx b/sd/source/ui/view/viewoverlaymanager.cxx index c786a70bd5e0..81fc252c7a6b 100644 --- a/sd/source/ui/view/viewoverlaymanager.cxx +++ b/sd/source/ui/view/viewoverlaymanager.cxx @@ -24,7 +24,7 @@ #include <sfx2/dispatch.hxx> #include <vcl/help.hxx> -#include <vcl/lazydelete.hxx> +#include <tools/lazydelete.hxx> #include <vcl/ptrstyle.hxx> #include <vcl/svapp.hxx> @@ -88,8 +88,16 @@ constexpr OUString aBigPlaceHolders[] = static BitmapEx& getButtonImage( int index, bool large ) { - static vcl::DeleteOnDeinit< BitmapEx > gSmallButtonImages[SAL_N_ELEMENTS(aSmallPlaceHolders)] = { vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty }; - static vcl::DeleteOnDeinit< BitmapEx > gLargeButtonImages[SAL_N_ELEMENTS(aBigPlaceHolders)] = { vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty, vcl::DeleteOnDeinitFlag::Empty }; + static ::tools::DeleteOnDeinit< BitmapEx > gSmallButtonImages[SAL_N_ELEMENTS(aSmallPlaceHolders)] = { + ::tools::DeleteOnDeinitFlag::Empty, ::tools::DeleteOnDeinitFlag::Empty, + ::tools::DeleteOnDeinitFlag::Empty, ::tools::DeleteOnDeinitFlag::Empty, + ::tools::DeleteOnDeinitFlag::Empty, ::tools::DeleteOnDeinitFlag::Empty, + ::tools::DeleteOnDeinitFlag::Empty, ::tools::DeleteOnDeinitFlag::Empty }; + static ::tools::DeleteOnDeinit< BitmapEx > gLargeButtonImages[SAL_N_ELEMENTS(aBigPlaceHolders)] = { + ::tools::DeleteOnDeinitFlag::Empty, ::tools::DeleteOnDeinitFlag::Empty, + ::tools::DeleteOnDeinitFlag::Empty, ::tools::DeleteOnDeinitFlag::Empty, + ::tools::DeleteOnDeinitFlag::Empty, ::tools::DeleteOnDeinitFlag::Empty, + ::tools::DeleteOnDeinitFlag::Empty, ::tools::DeleteOnDeinitFlag::Empty }; assert(SAL_N_ELEMENTS(aSmallPlaceHolders) == SAL_N_ELEMENTS(aBigPlaceHolders)); diff --git a/solenv/clang-format/excludelist b/solenv/clang-format/excludelist index 3d9f9f84e180..f5414f105fe0 100644 --- a/solenv/clang-format/excludelist +++ b/solenv/clang-format/excludelist @@ -6101,6 +6101,7 @@ include/tools/helpers.hxx include/tools/inetmime.hxx include/tools/inetmsg.hxx include/tools/inetstrm.hxx +include/tools/lazydelete.hxx include/tools/line.hxx include/tools/lineend.hxx include/tools/link.hxx @@ -6295,7 +6296,6 @@ include/vcl/inputtypes.hxx include/vcl/jobset.hxx include/vcl/keycod.hxx include/vcl/layout.hxx -include/vcl/lazydelete.hxx include/vcl/lineinfo.hxx include/vcl/mapmod.hxx include/vcl/menu.hxx diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx index 061a794af57c..c7048b166c6f 100644 --- a/sot/source/base/exchange.cxx +++ b/sot/source/base/exchange.cxx @@ -21,6 +21,7 @@ #include <tools/debug.hxx> #include <tools/globname.hxx> +#include <tools/lazydelete.hxx> #include <sot/exchange.hxx> #include <sot/formats.hxx> #include <comphelper/classids.hxx> @@ -210,9 +211,9 @@ const DataFlavorRepresentation* FormatArray_Impl() static tDataFlavorList& InitFormats_Impl() { - static tDataFlavorList gImplData; + static tools::DeleteOnDeinit<tDataFlavorList> gImplData; - return gImplData; + return *gImplData.get(); } /************************************************************************* diff --git a/svx/source/sdr/contact/viewcontactofsdrpage.cxx b/svx/source/sdr/contact/viewcontactofsdrpage.cxx index dee5ab7865db..9a1d32dc6345 100644 --- a/svx/source/sdr/contact/viewcontactofsdrpage.cxx +++ b/svx/source/sdr/contact/viewcontactofsdrpage.cxx @@ -34,7 +34,7 @@ #include <basegfx/polygon/b2dpolygon.hxx> #include <sdr/primitive2d/sdrattributecreator.hxx> #include <sdr/primitive2d/sdrdecompositiontools.hxx> -#include <vcl/lazydelete.hxx> +#include <tools/lazydelete.hxx> #include <vcl/settings.hxx> #include <drawinglayer/primitive2d/discreteshadowprimitive2d.hxx> #include <drawinglayer/attribute/sdrfillattribute.hxx> @@ -135,7 +135,7 @@ void ViewContactOfPageShadow::createViewIndependentPrimitive2DSequence(drawingla } else { - static vcl::DeleteOnDeinit< drawinglayer::primitive2d::DiscreteShadow > aDiscreteShadow(( + static tools::DeleteOnDeinit< drawinglayer::primitive2d::DiscreteShadow > aDiscreteShadow(( BitmapEx(SIP_SA_PAGESHADOW35X35))); if(aDiscreteShadow.get()) diff --git a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx index ff733c0b6e53..a1cdeb7df6f9 100644 --- a/svx/source/sdr/primitive2d/sdrprimitivetools.cxx +++ b/svx/source/sdr/primitive2d/sdrprimitivetools.cxx @@ -18,7 +18,7 @@ */ #include <sdr/primitive2d/sdrprimitivetools.hxx> -#include <vcl/lazydelete.hxx> +#include <tools/lazydelete.hxx> #include <vcl/BitmapTools.hxx> #include <mutex> @@ -29,7 +29,7 @@ namespace drawinglayer::primitive2d { BitmapEx createDefaultCross_3x3(const basegfx::BColor& rBColor) { - static vcl::DeleteOnDeinit< BitmapEx > aRetVal(vcl::DeleteOnDeinitFlag::Empty); + static tools::DeleteOnDeinit< BitmapEx > aRetVal(tools::DeleteOnDeinitFlag::Empty); static basegfx::BColor aBColor; static std::mutex aMutex; diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx index 73296e97a1f3..5666c1c03993 100644 --- a/svx/source/svdraw/svdhdl.cxx +++ b/svx/source/svdraw/svdhdl.cxx @@ -52,7 +52,7 @@ #include <svx/sdrpaintwindow.hxx> #include <vcl/svapp.hxx> #include <svx/sdr/overlay/overlaypolypolygon.hxx> -#include <vcl/lazydelete.hxx> +#include <tools/lazydelete.hxx> #include <vcl/BitmapTools.hxx> #include <svx/sdr/contact/objectcontact.hxx> #include <svx/sdr/contact/viewcontact.hxx> @@ -776,7 +776,7 @@ BitmapEx ImpGetBitmapEx(BitmapMarkerKind eKindOfMarker, BitmapColorIndex eIndex) // if we can't load the marker... - static vcl::DeleteOnDeinit< SdrHdlBitmapSet > aModernSet {}; + static tools::DeleteOnDeinit< SdrHdlBitmapSet > aModernSet {}; return aModernSet.get()->GetBitmapEx(eKindOfMarker, sal_uInt16(eIndex)); } diff --git a/svx/source/svdraw/svdobj.cxx b/svx/source/svdraw/svdobj.cxx index 76a4d4483743..892884b04f11 100644 --- a/svx/source/svdraw/svdobj.cxx +++ b/svx/source/svdraw/svdobj.cxx @@ -119,7 +119,7 @@ #include <rtl/character.hxx> #include <tools/UnitConversion.hxx> #include <o3tl/string_view.hxx> -#include <vcl/lazydelete.hxx> +#include <tools/lazydelete.hxx> using namespace ::com::sun::star; @@ -509,7 +509,7 @@ void SdrObject::handlePageChange(SdrPage*, SdrPage* ) // init global static itempool SdrItemPool& SdrObject::GetGlobalDrawObjectItemPool() { - static vcl::DeleteRtlReferenceOnDeinit<SdrItemPool> xGlobalItemPool( []() { + static tools::DeleteRtlReferenceOnDeinit<SdrItemPool> xGlobalItemPool( []() { rtl::Reference<SdrItemPool> xNewPool(new SdrItemPool()); rtl::Reference<SfxItemPool> pGlobalOutlPool = EditEngine::CreatePool(); xNewPool->SetSecondaryPool(pGlobalOutlPool.get()); diff --git a/sw/inc/pch/precompiled_vbaswobj.hxx b/sw/inc/pch/precompiled_vbaswobj.hxx index 88ac8570d5fe..4139cfe26b1b 100644 --- a/sw/inc/pch/precompiled_vbaswobj.hxx +++ b/sw/inc/pch/precompiled_vbaswobj.hxx @@ -117,7 +117,7 @@ #include <vcl/kernarray.hxx> #include <vcl/keycod.hxx> #include <vcl/keycodes.hxx> -#include <vcl/lazydelete.hxx> +#include <tools/lazydelete.hxx> #include <vcl/mapmod.hxx> #include <vcl/metaactiontypes.hxx> #include <vcl/outdev.hxx> diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index 896a237b27c4..f453cc375f1d 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -27,7 +27,7 @@ #include <stack> #include <vcl/mapmod.hxx> #include <vcl/vclptr.hxx> -#include <vcl/lazydelete.hxx> +#include <tools/lazydelete.hxx> #include <vcl/window.hxx> namespace com::sun::star::accessibility { class XAccessible; } @@ -193,7 +193,7 @@ class SAL_DLLPUBLIC_RTTI SwViewShell : public sw::Ring<SwViewShell> protected: static ShellResource* spShellRes; ///< Resources for the Shell. - static vcl::DeleteOnDeinit< std::shared_ptr<weld::Window> > spCareDialog; ///< Avoid this window. + static tools::DeleteOnDeinit< std::shared_ptr<weld::Window> > spCareDialog; ///< Avoid this window. SwRect maVisArea; ///< The modern version of VisArea. tools::Rectangle maLOKVisibleArea;///< The visible area in the LibreOfficeKit client. diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index f18503ff07a7..c853a772542d 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -19,7 +19,7 @@ #include <utility> #include <vcl/canvastools.hxx> -#include <vcl/lazydelete.hxx> +#include <tools/lazydelete.hxx> #include <sfx2/docfile.hxx> #include <sfx2/printer.hxx> #include <sfx2/progress.hxx> @@ -6400,19 +6400,19 @@ static void lcl_paintBitmapExToRect(vcl::RenderContext *pOut, const Point& aPoin // #i16816# tagged pdf support SwTaggedPDFHelper aTaggedPDFHelper( nullptr, nullptr, nullptr, *_pViewShell->GetOut() ); - static vcl::DeleteOnDeinit<drawinglayer::primitive2d::DiscreteShadow> shadowMaskObj( + static tools::DeleteOnDeinit<drawinglayer::primitive2d::DiscreteShadow> shadowMaskObj( vcl::bitmap::loadFromName(BMP_PAGE_SHADOW_MASK, ImageLoadFlags::IgnoreDarkTheme | ImageLoadFlags::IgnoreScalingFactor)); drawinglayer::primitive2d::DiscreteShadow& shadowMask = *shadowMaskObj.get(); - static vcl::DeleteOnDeinit< BitmapEx > aPageTopRightShadowObj {}; - static vcl::DeleteOnDeinit< BitmapEx > aPageBottomRightShadowObj {}; - static vcl::DeleteOnDeinit< BitmapEx > aPageBottomLeftShadowObj {}; - static vcl::DeleteOnDeinit< BitmapEx > aPageBottomShadowBaseObj {}; - static vcl::DeleteOnDeinit< BitmapEx > aPageRightShadowBaseObj {}; - static vcl::DeleteOnDeinit< BitmapEx > aPageTopShadowBaseObj {}; - static vcl::DeleteOnDeinit< BitmapEx > aPageTopLeftShadowObj {}; - static vcl::DeleteOnDeinit< BitmapEx > aPageLeftShadowBaseObj {}; + static tools::DeleteOnDeinit< BitmapEx > aPageTopRightShadowObj {}; + static tools::DeleteOnDeinit< BitmapEx > aPageBottomRightShadowObj {}; + static tools::DeleteOnDeinit< BitmapEx > aPageBottomLeftShadowObj {}; + static tools::DeleteOnDeinit< BitmapEx > aPageBottomShadowBaseObj {}; + static tools::DeleteOnDeinit< BitmapEx > aPageRightShadowBaseObj {}; + static tools::DeleteOnDeinit< BitmapEx > aPageTopShadowBaseObj {}; + static tools::DeleteOnDeinit< BitmapEx > aPageTopLeftShadowObj {}; + static tools::DeleteOnDeinit< BitmapEx > aPageLeftShadowBaseObj {}; BitmapEx& aPageTopRightShadow = *aPageTopRightShadowObj.get(); BitmapEx& aPageBottomRightShadow = *aPageBottomRightShadowObj.get(); BitmapEx& aPageBottomLeftShadow = *aPageBottomLeftShadowObj.get(); diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index e9407b7af9d7..c0ae4b639d81 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -26,7 +26,7 @@ #include <vcl/lineinfo.hxx> #include <vcl/metric.hxx> #include <vcl/svapp.hxx> -#include <vcl/lazydelete.hxx> +#include <tools/lazydelete.hxx> #include <vcl/glyphitemcache.hxx> #include <com/sun/star/i18n/CharacterIteratorMode.hpp> #include <com/sun/star/i18n/WordType.hpp> @@ -72,7 +72,7 @@ constexpr Color gWaveCol(COL_GRAY); tools::Long SwFntObj::s_nPixWidth; MapMode* SwFntObj::s_pPixMap = nullptr; -static vcl::DeleteOnDeinit< VclPtr<OutputDevice> > s_pFntObjPixOut {}; +static tools::DeleteOnDeinit< VclPtr<OutputDevice> > s_pFntObjPixOut {}; void SwFntCache::Flush( ) { diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index ee06ea0179d7..a1bc4407f664 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -89,7 +89,7 @@ bool SwViewShell::sbLstAct = false; ShellResource *SwViewShell::spShellRes = nullptr; -vcl::DeleteOnDeinit<std::shared_ptr<weld::Window>> SwViewShell::spCareDialog {}; +tools::DeleteOnDeinit<std::shared_ptr<weld::Window>> SwViewShell::spCareDialog {}; static bool bInSizeNotify = false; diff --git a/tools/Library_tl.mk b/tools/Library_tl.mk index e2f1a9fccbf6..b82c065bdeef 100644 --- a/tools/Library_tl.mk +++ b/tools/Library_tl.mk @@ -72,6 +72,7 @@ $(eval $(call gb_Library_add_exception_objects,tl,\ tools/source/misc/cpuid \ tools/source/misc/extendapplicationenvironment \ tools/source/misc/json_writer \ + tools/source/misc/lazydelete \ tools/source/misc/UniqueID \ tools/source/ref/globname \ tools/source/ref/ref \ diff --git a/vcl/source/helper/lazydelete.cxx b/tools/source/misc/lazydelete.cxx index af1f9fcb3308..1d441e432dce 100644 --- a/vcl/source/helper/lazydelete.cxx +++ b/tools/source/misc/lazydelete.cxx @@ -17,42 +17,38 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <vcl/lazydelete.hxx> -#include <svdata.hxx> +#include <tools/lazydelete.hxx> #include <sal/log.hxx> +#include <vector> -namespace vcl +namespace tools { -DeleteOnDeinitBase::~DeleteOnDeinitBase() -{ - ImplSVData* pSVData = ImplGetSVData(); - if (!pSVData) - return; - auto& rList = pSVData->maDeinitDeleteList; - std::erase(rList, this); -} +static std::vector<tools::DeleteOnDeinitBase*> gDeinitDeleteList; +static bool gShutdown = false; + +DeleteOnDeinitBase::~DeleteOnDeinitBase() { std::erase(gDeinitDeleteList, this); } void DeleteOnDeinitBase::addDeinitContainer(DeleteOnDeinitBase* i_pContainer) { - ImplSVData* pSVData = ImplGetSVData(); - - SAL_WARN_IF(pSVData->mbDeInit, "vcl", "DeleteOnDeinit added after DeiInitVCL !"); - if (pSVData->mbDeInit) + if (gShutdown) + { + SAL_WARN("tools", "DeleteOnDeinit added after DeiInitVCL !"); return; + } - pSVData->maDeinitDeleteList.push_back(i_pContainer); + gDeinitDeleteList.push_back(i_pContainer); } void DeleteOnDeinitBase::ImplDeleteOnDeInit() { - ImplSVData* pSVData = ImplGetSVData(); - for (auto const& deinitDelete : pSVData->maDeinitDeleteList) + gShutdown = true; + for (auto const& deinitDelete : gDeinitDeleteList) { deinitDelete->doCleanup(); } - pSVData->maDeinitDeleteList.clear(); + gDeinitDeleteList.clear(); } -} // namespace vcl +} // namespace tools /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index 8d51d7157bcf..a59285a26dfb 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -390,7 +390,6 @@ $(eval $(call gb_Library_add_exception_objects,vcl,\ vcl/source/helper/driverblocklist \ vcl/source/helper/evntpost \ vcl/source/helper/idletask \ - vcl/source/helper/lazydelete \ vcl/source/helper/strhelper \ vcl/source/helper/svtaccessiblefactory \ vcl/source/helper/threadex \ diff --git a/vcl/inc/pch/precompiled_vcl.hxx b/vcl/inc/pch/precompiled_vcl.hxx index 00d156760020..6adbba81df4d 100644 --- a/vcl/inc/pch/precompiled_vcl.hxx +++ b/vcl/inc/pch/precompiled_vcl.hxx @@ -348,7 +348,7 @@ #include <vcl/idle.hxx> #include <vcl/image.hxx> #include <vcl/layout.hxx> -#include <vcl/lazydelete.hxx> +#include <tools/lazydelete.hxx> #include <vcl/lineinfo.hxx> #include <vcl/menu.hxx> #include <vcl/metaact.hxx> diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index 3619de00d25b..584018ccfdbe 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -128,7 +128,6 @@ namespace vcl { class DisplayConnectionDispatch; class SettingsConfigItem; - class DeleteOnDeinitBase; class Window; } @@ -421,7 +420,6 @@ struct ImplSVData css::uno::Reference< css::lang::XComponent > mxAccessBridge; std::unique_ptr<vcl::SettingsConfigItem> mpSettingsConfigItem; - std::vector< vcl::DeleteOnDeinitBase* > maDeinitDeleteList; std::unordered_map< int, OUString > maPaperNames; css::uno::Reference<css::i18n::XCharacterClassification> m_xCharClass; diff --git a/vcl/skia/gdiimpl.cxx b/vcl/skia/gdiimpl.cxx index 83b9fd6810c6..f6c7d21374bf 100644 --- a/vcl/skia/gdiimpl.cxx +++ b/vcl/skia/gdiimpl.cxx @@ -23,7 +23,7 @@ #include <skia/salbmp.hxx> #include <vcl/idle.hxx> #include <vcl/svapp.hxx> -#include <vcl/lazydelete.hxx> +#include <tools/lazydelete.hxx> #include <vcl/gradient.hxx> #include <vcl/skia/SkiaHelper.hxx> #include <skia/utils.hxx> diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index 47df58d33965..a8a2412aa810 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -45,7 +45,7 @@ #include <vcl/settings.hxx> #include <vcl/toolkit/unowrap.hxx> #include <configsettings.hxx> -#include <vcl/lazydelete.hxx> +#include <tools/lazydelete.hxx> #include <vcl/embeddedfontshelper.hxx> #include <vcl/toolkit/dialog.hxx> #include <vcl/menu.hxx> @@ -468,7 +468,7 @@ void DeInitVCL() // Some events may need to access objects destroyed in ImplDeleteOnDeInit, so process them first Scheduler::ProcessEventsToIdle(); - vcl::DeleteOnDeinitBase::ImplDeleteOnDeInit(); + tools::DeleteOnDeinitBase::ImplDeleteOnDeInit(); #if OSL_DEBUG_LEVEL > 0 OStringBuffer aBuf( 256 ); diff --git a/vcl/source/gdi/impglyphitem.cxx b/vcl/source/gdi/impglyphitem.cxx index 946230a51762..6001ccd0236b 100644 --- a/vcl/source/gdi/impglyphitem.cxx +++ b/vcl/source/gdi/impglyphitem.cxx @@ -21,7 +21,7 @@ #include <utility> #include <vcl/glyphitemcache.hxx> #include <vcl/vcllayout.hxx> -#include <vcl/lazydelete.hxx> +#include <tools/lazydelete.hxx> #include <tools/stream.hxx> #include <unotools/configmgr.hxx> #include <TextLayoutCache.hxx> @@ -234,7 +234,7 @@ void SalLayoutGlyphsCache::clear() { mCachedGlyphs.clear(); } SalLayoutGlyphsCache* SalLayoutGlyphsCache::self() { - static vcl::DeleteOnDeinit<SalLayoutGlyphsCache> cache( + static tools::DeleteOnDeinit<SalLayoutGlyphsCache> cache( !comphelper::IsFuzzing() ? officecfg::Office::Common::Cache::Font::GlyphsCacheSize::get() : 20000000); return cache.get(); diff --git a/vcl/source/opengl/x11/context.cxx b/vcl/source/opengl/x11/context.cxx index 93125f91085a..73dfbaf8cd8f 100644 --- a/vcl/source/opengl/x11/context.cxx +++ b/vcl/source/opengl/x11/context.cxx @@ -8,7 +8,7 @@ */ #include <memory> -#include <vcl/lazydelete.hxx> +#include <tools/lazydelete.hxx> #include <vcl/syschild.hxx> #include <svdata.hxx> diff --git a/vcl/source/outdev/outdev.cxx b/vcl/source/outdev/outdev.cxx index b2ca6382bfac..f177efab6cdb 100644 --- a/vcl/source/outdev/outdev.cxx +++ b/vcl/source/outdev/outdev.cxx @@ -24,7 +24,7 @@ #include <tools/debug.hxx> #include <vcl/graph.hxx> -#include <vcl/lazydelete.hxx> +#include <tools/lazydelete.hxx> #include <vcl/metaact.hxx> #include <vcl/toolkit/unowrap.hxx> #include <vcl/svapp.hxx> @@ -788,7 +788,7 @@ com::sun::star::uno::Reference< css::rendering::XCanvas > OutputDevice::ImplGetC Reference< XComponentContext > xContext = comphelper::getProcessComponentContext(); - static vcl::DeleteUnoReferenceOnDeinit<css::lang::XMultiComponentFactory> xStaticCanvasFactory( + static tools::DeleteUnoReferenceOnDeinit<css::lang::XMultiComponentFactory> xStaticCanvasFactory( css::rendering::CanvasFactory::create( xContext ) ); Reference<css::lang::XMultiComponentFactory> xCanvasFactory(xStaticCanvasFactory.get()); Reference< css::rendering::XCanvas > xCanvas; diff --git a/vcl/source/outdev/textline.cxx b/vcl/source/outdev/textline.cxx index 20315c6c6aaa..42ffa0613aa2 100644 --- a/vcl/source/outdev/textline.cxx +++ b/vcl/source/outdev/textline.cxx @@ -24,7 +24,7 @@ #include <o3tl/hash_combine.hxx> #include <o3tl/lru_map.hxx> #include <comphelper/configuration.hxx> -#include <vcl/lazydelete.hxx> +#include <tools/lazydelete.hxx> #include <vcl/metaact.hxx> #include <vcl/settings.hxx> #include <vcl/virdev.hxx> @@ -1051,7 +1051,7 @@ void OutputDevice::DrawWaveLine(const Point& rStartPos, const Point& rEndPos, to if ( fOrientation == 0.0 ) { - static vcl::DeleteOnDeinit< WavyLineCache > snLineCache {}; + static tools::DeleteOnDeinit< WavyLineCache > snLineCache {}; if ( !snLineCache.get() ) return; WavyLineCache& rLineCache = *snLineCache.get(); diff --git a/vcl/source/text/TextLayoutCache.cxx b/vcl/source/text/TextLayoutCache.cxx index 414ab29f895a..3e3571dfc861 100644 --- a/vcl/source/text/TextLayoutCache.cxx +++ b/vcl/source/text/TextLayoutCache.cxx @@ -24,7 +24,7 @@ #include <o3tl/hash_combine.hxx> #include <o3tl/lru_map.hxx> #include <unotools/configmgr.hxx> -#include <vcl/lazydelete.hxx> +#include <tools/lazydelete.hxx> #include <officecfg/Office/Common.hxx> namespace vcl::text @@ -55,7 +55,7 @@ std::shared_ptr<const TextLayoutCache> TextLayoutCache::Create(OUString const& r typedef o3tl::lru_map<OUString, std::shared_ptr<const TextLayoutCache>, FirstCharsStringHash, FastStringCompareEqual, TextLayoutCacheCost> Cache; - static vcl::DeleteOnDeinit<Cache> cache( + static tools::DeleteOnDeinit<Cache> cache( !comphelper::IsFuzzing() ? officecfg::Office::Common::Cache::Font::TextRunsCacheSize::get() : 100); if (Cache* map = cache.get()) diff --git a/vcl/source/window/split.cxx b/vcl/source/window/split.cxx index d25e2b677e36..adb82ad575c3 100644 --- a/vcl/source/window/split.cxx +++ b/vcl/source/window/split.cxx @@ -27,7 +27,7 @@ #include <vcl/lineinfo.hxx> #include <vcl/settings.hxx> #include <vcl/ptrstyle.hxx> -#include <vcl/lazydelete.hxx> +#include <tools/lazydelete.hxx> #include <window.h> @@ -35,12 +35,12 @@ namespace { Wallpaper& ImplBlackWall() { - static vcl::DeleteOnDeinit< Wallpaper > SINGLETON(COL_BLACK); + static tools::DeleteOnDeinit< Wallpaper > SINGLETON(COL_BLACK); return *SINGLETON.get(); } Wallpaper& ImplWhiteWall() { - static vcl::DeleteOnDeinit< Wallpaper > SINGLETON(COL_LIGHTGRAY); + static tools::DeleteOnDeinit< Wallpaper > SINGLETON(COL_LIGHTGRAY); return *SINGLETON.get(); } } diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index 10db9fd7a3d2..8cde4c668112 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -38,7 +38,7 @@ #include <vcl/toolkit/button.hxx> #include <vcl/taskpanelist.hxx> #include <vcl/toolkit/unowrap.hxx> -#include <vcl/lazydelete.hxx> +#include <tools/lazydelete.hxx> #include <vcl/virdev.hxx> #include <vcl/settings.hxx> #include <vcl/sysdata.hxx> @@ -3747,7 +3747,7 @@ Reference< css::rendering::XCanvas > WindowOutputDevice::ImplGetCanvas( bool bSp // Create canvas instance with window handle - static vcl::DeleteUnoReferenceOnDeinit<XMultiComponentFactory> xStaticCanvasFactory( + static tools::DeleteUnoReferenceOnDeinit<XMultiComponentFactory> xStaticCanvasFactory( css::rendering::CanvasFactory::create( xContext ) ); Reference<XMultiComponentFactory> xCanvasFactory(xStaticCanvasFactory.get()); Reference< css::rendering::XCanvas > xCanvas; |