From 4a66d7f0dd40c54307b5f750723f68b53703b01a Mon Sep 17 00:00:00 2001 From: Jan-Marek Glogowski Date: Wed, 31 Oct 2018 12:28:58 +0100 Subject: tdf#121030 invalidate referenced FontInstances MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This sets the FreetypeFont pointer of the FreetypeFontInstances to nullptr when clearing the cache. And it changes the interface functions of SalLayoutGlyphs to some variant different from std::vector. I don't know if we should prefer the mutable or the const font instance. With mutable at least one can invalidate the font instance when checking the IsValid(), so we can get rid of our referenced font instance. Change-Id: I6070cfcb3c549dbad3383bd4ec2b05b30645b753 Reviewed-on: https://gerrit.libreoffice.org/62688 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- vcl/inc/impglyphitem.hxx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'vcl/inc') diff --git a/vcl/inc/impglyphitem.hxx b/vcl/inc/impglyphitem.hxx index 4c7673ed2077..009be6cc2506 100644 --- a/vcl/inc/impglyphitem.hxx +++ b/vcl/inc/impglyphitem.hxx @@ -98,13 +98,15 @@ protected: public: virtual ~SalLayoutGlyphsImpl(); virtual SalLayoutGlyphsImpl* clone(SalLayoutGlyphs&) const = 0; + virtual bool IsValid() const = 0; + virtual void Invalidate() = 0; }; class SalGenericLayoutGlyphsImpl : public SalLayoutGlyphsImpl { friend class GenericSalLayout; - const rtl::Reference m_rFontInstance; + mutable rtl::Reference m_rFontInstance; SalGenericLayoutGlyphsImpl(SalLayoutGlyphs& rGlyphs, LogicalFontInstance& rFontInstance) : m_rFontInstance(&rFontInstance) @@ -115,6 +117,8 @@ class SalGenericLayoutGlyphsImpl : public SalLayoutGlyphsImpl public: SalLayoutGlyphsImpl* clone(SalLayoutGlyphs& rGlyphs) const override; LogicalFontInstance& GetFont() const { return *m_rFontInstance; } + bool IsValid() const override; + void Invalidate() override; }; #endif // INCLUDED_VCL_IMPGLYPHITEM_HXX -- cgit