diff --git a/0001-font-cache-gets-broken-on-adding-an-embedded-font.patch b/0001-font-cache-gets-broken-on-adding-an-embedded-font.patch new file mode 100644 index 0000000..c4c0b3d --- /dev/null +++ b/0001-font-cache-gets-broken-on-adding-an-embedded-font.patch @@ -0,0 +1,171 @@ +From 6d56eb949eda659364aac738ddc1ba665fefbe4a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Caol=C3=A1n=20McNamara?= +Date: Tue, 20 Jan 2015 11:24:26 +0000 +Subject: [PATCH] font cache gets broken on adding an embedded font + +(cherry picked from commit 20142afafc809890d5e8dcfd4103c46319a488df) + +Conflicts: + vcl/source/gdi/embeddedfontshelper.cxx + +Change-Id: I665cde5d4c89443238efb283c86277dedf621197 +--- + include/vcl/outdev.hxx | 9 ++++++++ + vcl/inc/outdev.h | 2 ++ + vcl/source/gdi/embeddedfontshelper.cxx | 5 +++-- + vcl/source/outdev/font.cxx | 39 ++++++++++++++++++++++++++++------ + 4 files changed, 47 insertions(+), 8 deletions(-) + +diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx +index 3e98666..21f5931 100644 +--- a/include/vcl/outdev.hxx ++++ b/include/vcl/outdev.hxx +@@ -1133,6 +1133,15 @@ public: + + SAL_DLLPRIVATE void ImplInitFontList() const; + SAL_DLLPRIVATE void ImplUpdateFontData( bool bNewFontLists ); ++ ++ //drop font data for all outputdevices. ++ //If bNewFontLists is true then empty lists of system fonts ++ SAL_DLLPRIVATE static void ImplClearAllFontData( bool bNewFontLists ); ++ //fetch font data for all outputdevices ++ //If bNewFontLists is true then fetch lists of system fonts ++ SAL_DLLPRIVATE static void ImplRefreshAllFontData( bool bNewFontLists ); ++ //drop and fetch font data for all outputdevices ++ //If bNewFontLists is true then drop and refetch lists of system fonts + SAL_DLLPRIVATE static void ImplUpdateAllFontData( bool bNewFontLists ); + + protected: +diff --git a/vcl/inc/outdev.h b/vcl/inc/outdev.h +index dcde57c..a2f3b09 100644 +--- a/vcl/inc/outdev.h ++++ b/vcl/inc/outdev.h +@@ -143,6 +143,8 @@ private: + typedef ::boost::unordered_map FontInstanceList; + FontInstanceList maFontInstanceList; + ++ int CountUnreferencedEntries() const; ++ + public: + ImplFontCache(); + ~ImplFontCache(); +diff --git a/vcl/source/gdi/embeddedfontshelper.cxx b/vcl/source/gdi/embeddedfontshelper.cxx +index 1eca07e..4c8d907 100644 +--- a/vcl/source/gdi/embeddedfontshelper.cxx ++++ b/vcl/source/gdi/embeddedfontshelper.cxx +@@ -181,8 +181,9 @@ OUString EmbeddedFontsHelper::fileUrlForTemporaryFont( const OUString& fontName, + void EmbeddedFontsHelper::activateFont( const OUString& fontName, const OUString& fileUrl ) + { + OutputDevice *pDevice = Application::GetDefaultDevice(); +- pDevice->AddTempDevFont( fileUrl, fontName ); +- pDevice->ImplUpdateAllFontData( true ); ++ OutputDevice::ImplClearAllFontData(true); ++ pDevice->AddTempDevFont(fileUrl, fontName); ++ OutputDevice::ImplRefreshAllFontData(true); + } + + // Check if it's (legally) allowed to embed the font file into a document +diff --git a/vcl/source/outdev/font.cxx b/vcl/source/outdev/font.cxx +index 7104caa..9df60e3 100644 +--- a/vcl/source/outdev/font.cxx ++++ b/vcl/source/outdev/font.cxx +@@ -154,6 +154,7 @@ bool OutputDevice::AddTempDevFont( const OUString& rFileURL, const OUString& rFo + if( mpAlphaVDev ) + mpAlphaVDev->AddTempDevFont( rFileURL, rFontName ); + ++ ImplClearFontData(true); + mpFontCache->Invalidate(); + return true; + } +@@ -568,7 +569,7 @@ void OutputDevice::ImplUpdateFontData( bool bNewFontLists ) + ImplRefreshFontData( bNewFontLists ); + } + +-void OutputDevice::ImplUpdateAllFontData( bool bNewFontLists ) ++void OutputDevice::ImplClearAllFontData(bool bNewFontLists) + { + ImplSVData* pSVData = ImplGetSVData(); + +@@ -591,10 +592,19 @@ void OutputDevice::ImplUpdateAllFontData( bool bNewFontLists ) + } + } + } ++} + ++void OutputDevice::ImplRefreshAllFontData(bool bNewFontLists) ++{ + ImplUpdateFontDataForAllFrames( &OutputDevice::ImplRefreshFontData, bNewFontLists ); + } + ++void OutputDevice::ImplUpdateAllFontData(bool bNewFontLists) ++{ ++ OutputDevice::ImplClearAllFontData(bNewFontLists); ++ OutputDevice::ImplRefreshAllFontData(bNewFontLists); ++} ++ + void OutputDevice::ImplUpdateFontDataForAllFrames( const FontUpdateHandler_t pHdl, const bool bNewFontLists ) + { + ImplSVData* const pSVData = ImplGetSVData(); +@@ -1364,11 +1374,11 @@ void ImplFontCache::Release( ImplFontEntry* pEntry ) + { + static const int FONTCACHE_MAX = 50; + +- DBG_ASSERT( (pEntry->mnRefCount > 0), "ImplFontCache::Release() - font refcount underflow" ); ++ assert(pEntry->mnRefCount > 0 && "ImplFontCache::Release() - font refcount underflow"); + if( --pEntry->mnRefCount > 0 ) + return; + +- if( ++mnRef0Count < FONTCACHE_MAX ) ++ if (++mnRef0Count < FONTCACHE_MAX) + return; + + // remove unused entries from font instance cache +@@ -1383,17 +1393,34 @@ void ImplFontCache::Release( ImplFontEntry* pEntry ) + maFontInstanceList.erase( it ); + delete pFontEntry; + --mnRef0Count; +- DBG_ASSERT( (mnRef0Count>=0), "ImplFontCache::Release() - refcount0 underflow" ); ++ assert(mnRef0Count>=0 && "ImplFontCache::Release() - refcount0 underflow"); + + if( mpFirstEntry == pFontEntry ) + mpFirstEntry = NULL; + } + +- DBG_ASSERT( (mnRef0Count==0), "ImplFontCache::Release() - refcount0 mismatch" ); ++ assert(mnRef0Count==0 && "ImplFontCache::Release() - refcount0 mismatch"); ++} ++ ++int ImplFontCache::CountUnreferencedEntries() const ++{ ++ size_t nCount = 0; ++ // count unreferenced entries ++ for (FontInstanceList::const_iterator it = maFontInstanceList.begin(); ++ it != maFontInstanceList.end(); ++it) ++ { ++ const ImplFontEntry* pFontEntry = it->second; ++ if (pFontEntry->mnRefCount > 0) ++ continue; ++ ++nCount; ++ } ++ return nCount; + } + + void ImplFontCache::Invalidate() + { ++ assert(CountUnreferencedEntries() == mnRef0Count); ++ + // delete unreferenced entries + FontInstanceList::iterator it = maFontInstanceList.begin(); + for(; it != maFontInstanceList.end(); ++it ) +@@ -1410,7 +1437,7 @@ void ImplFontCache::Invalidate() + mpFirstEntry = NULL; + maFontInstanceList.clear(); + +- DBG_ASSERT( (mnRef0Count==0), "ImplFontCache::Invalidate() - mnRef0Count non-zero" ); ++ assert(mnRef0Count==0 && "ImplFontCache::Invalidate() - mnRef0Count non-zero"); + } + + void OutputDevice::ImplInitFontList() const +-- +1.9.3 + diff --git a/libreoffice.spec b/libreoffice.spec index cbf0d83..cd4c066 100644 --- a/libreoffice.spec +++ b/libreoffice.spec @@ -370,6 +370,7 @@ Patch62: 0001-rhbz-1180114-writerfilter-don-t-crash-on-w-customXml.patch Patch63: 0001-Resolves-rhbz-1162352-SwDataChanged-dtor-accesses-de.patch Patch64: 0001-Resolves-fdo-86978-append-formula-cells-to-track-ins.patch Patch65: 0001-if-we-change-the-keys-we-have-to-resort-based-on-the.patch +Patch66: 0001-font-cache-gets-broken-on-adding-an-embedded-font.patch %define instdir %{_libdir} %define baseinstdir %{instdir}/libreoffice @@ -2342,8 +2343,9 @@ update-desktop-database %{_datadir}/applications &> /dev/null || : %changelog * Mon Jan 19 2015 Caolán McNamara - 1:4.3.5.2-12-UNBUILT -- if we change the keys we have to resort based on the new keys - Resolves: rhbz#1136013 ExternalToolEdit crash +- font cache gets broken on adding an embedded font +- if we change the keys we have to resort based on the new keys * Fri Jan 16 2015 Eike Rathke - 1:4.3.5.2-11 - Resolves: rhbz#1171828 fdo#86978 append formula cells to track instead of tree