[libreoffice/f19] Resolves: rhbz#1057977 do not crash when fonts are updated
David Tardon
dtardon at fedoraproject.org
Thu Feb 27 09:29:07 UTC 2014
commit df5b2129d7e945102887c03707cf3473e5dac5b1
Author: David Tardon <dtardon at redhat.com>
Date: Thu Feb 27 10:25:22 2014 +0100
Resolves: rhbz#1057977 do not crash when fonts are updated
Conflicts:
libreoffice.spec
...1057977-avoid-use-of-invalidated-pointers.patch | 156 ++++++++++++++++++++
libreoffice.spec | 3 +
2 files changed, 159 insertions(+), 0 deletions(-)
---
diff --git a/0001-rhbz-1057977-avoid-use-of-invalidated-pointers.patch b/0001-rhbz-1057977-avoid-use-of-invalidated-pointers.patch
new file mode 100644
index 0000000..563d634
--- /dev/null
+++ b/0001-rhbz-1057977-avoid-use-of-invalidated-pointers.patch
@@ -0,0 +1,156 @@
+From 6b127d40c7d57745bc602d9ff7914392f9d3b92b Mon Sep 17 00:00:00 2001
+From: David Tardon <dtardon at redhat.com>
+Date: Wed, 5 Feb 2014 10:55:25 +0100
+Subject: [PATCH] rhbz#1057977 avoid use of invalidated pointers
+
+Change-Id: Ib81f79da696b5e8002f5a2ddcf160903231dc3f1
+---
+ include/vcl/outdev.hxx | 6 +++++
+ vcl/source/gdi/outdev3.cxx | 59 +++++++++++++++++++++++++++++++++++++++++-----
+ 2 files changed, 59 insertions(+), 6 deletions(-)
+
+diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
+index 8a7c439..4223135 100644
+--- a/include/vcl/outdev.hxx
++++ b/include/vcl/outdev.hxx
+@@ -537,9 +537,15 @@ protected:
+ OutputDevice();
+
+ private:
++ typedef void ( OutputDevice::* FontUpdateHandler_t )( bool );
++
+ SAL_DLLPRIVATE OutputDevice( const OutputDevice& rOutDev );
+ SAL_DLLPRIVATE OutputDevice& operator =( const OutputDevice& rOutDev );
+
++ SAL_DLLPRIVATE void ImplClearFontData( bool bNewFontLists );
++ SAL_DLLPRIVATE void ImplRefreshFontData( bool bNewFontLists );
++ SAL_DLLPRIVATE static void ImplUpdateFontDataForAllFrames( FontUpdateHandler_t pHdl, bool bNewFontLists );
++
+ public:
+ virtual ~OutputDevice();
+
+diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx
+index 5c5dcf2..c347f71 100644
+--- a/vcl/source/gdi/outdev3.cxx
++++ b/vcl/source/gdi/outdev3.cxx
+@@ -154,7 +154,7 @@ static void ImplRotatePos( long nOriginX, long nOriginY, long& rX, long& rY,
+ }
+ }
+
+-void OutputDevice::ImplUpdateFontData( bool bNewFontLists )
++void OutputDevice::ImplClearFontData( const bool bNewFontLists )
+ {
+ // the currently selected logical font is no longer needed
+ if ( mpFontEntry )
+@@ -205,6 +205,38 @@ void OutputDevice::ImplUpdateFontData( bool bNewFontLists )
+ delete mpFontList;
+ if( mpFontCache && mpFontCache != pSVData->maGDIData.mpScreenFontCache )
+ delete mpFontCache;
++ mpFontList = 0;
++ mpFontCache = 0;
++ }
++ }
++ }
++ }
++
++ // also update child windows if needed
++ if ( GetOutDevType() == OUTDEV_WINDOW )
++ {
++ Window* pChild = ((Window*)this)->mpWindowImpl->mpFirstChild;
++ while ( pChild )
++ {
++ pChild->ImplClearFontData( true );
++ pChild = pChild->mpWindowImpl->mpNext;
++ }
++ }
++}
++
++void OutputDevice::ImplRefreshFontData( const bool bNewFontLists )
++{
++// if ( GetOutDevType() == OUTDEV_PRINTER || mpPDFWriter )
++ {
++ ImplSVData* pSVData = ImplGetSVData();
++
++ if ( bNewFontLists )
++ {
++ // we need a graphics
++ if ( ImplGetGraphics() )
++ {
++ if( mpPDFWriter )
++ {
+ mpFontList = pSVData->maGDIData.mpScreenFontList->Clone( true, true );
+ mpFontCache = new ImplFontCache();
+ }
+@@ -222,16 +254,24 @@ void OutputDevice::ImplUpdateFontData( bool bNewFontLists )
+ Window* pChild = ((Window*)this)->mpWindowImpl->mpFirstChild;
+ while ( pChild )
+ {
+- pChild->ImplUpdateFontData( true );
++ pChild->ImplRefreshFontData( true );
+ pChild = pChild->mpWindowImpl->mpNext;
+ }
+ }
+ }
+
++void OutputDevice::ImplUpdateFontData( bool bNewFontLists )
++{
++ ImplClearFontData( bNewFontLists );
++ ImplRefreshFontData( bNewFontLists );
++}
++
+ void OutputDevice::ImplUpdateAllFontData( bool bNewFontLists )
+ {
+ ImplSVData* pSVData = ImplGetSVData();
+
++ ImplUpdateFontDataForAllFrames( &OutputDevice::ImplClearFontData, bNewFontLists );
++
+ // clear global font lists to have them updated
+ pSVData->maGDIData.mpScreenFontCache->Invalidate();
+ if ( bNewFontLists )
+@@ -250,16 +290,23 @@ void OutputDevice::ImplUpdateAllFontData( bool bNewFontLists )
+ }
+ }
+
++ ImplUpdateFontDataForAllFrames( &OutputDevice::ImplRefreshFontData, bNewFontLists );
++}
++
++void OutputDevice::ImplUpdateFontDataForAllFrames( const FontUpdateHandler_t pHdl, const bool bNewFontLists )
++{
++ ImplSVData* const pSVData = ImplGetSVData();
++
+ // update all windows
+ Window* pFrame = pSVData->maWinData.mpFirstFrame;
+ while ( pFrame )
+ {
+- pFrame->ImplUpdateFontData( bNewFontLists );
++ ( pFrame->*pHdl )( bNewFontLists );
+
+ Window* pSysWin = pFrame->mpWindowImpl->mpFrameData->mpFirstOverlap;
+ while ( pSysWin )
+ {
+- pSysWin->ImplUpdateFontData( bNewFontLists );
++ ( pSysWin->*pHdl )( bNewFontLists );
+ pSysWin = pSysWin->mpWindowImpl->mpNextOverlap;
+ }
+
+@@ -270,7 +317,7 @@ void OutputDevice::ImplUpdateAllFontData( bool bNewFontLists )
+ VirtualDevice* pVirDev = pSVData->maGDIData.mpFirstVirDev;
+ while ( pVirDev )
+ {
+- pVirDev->ImplUpdateFontData( bNewFontLists );
++ ( pVirDev->*pHdl )( bNewFontLists );
+ pVirDev = pVirDev->mpNext;
+ }
+
+@@ -278,7 +325,7 @@ void OutputDevice::ImplUpdateAllFontData( bool bNewFontLists )
+ Printer* pPrinter = pSVData->maGDIData.mpFirstPrinter;
+ while ( pPrinter )
+ {
+- pPrinter->ImplUpdateFontData( bNewFontLists );
++ ( pPrinter->*pHdl )( bNewFontLists );
+ pPrinter = pPrinter->mpNext;
+ }
+ }
+--
+1.8.5.3
+
diff --git a/libreoffice.spec b/libreoffice.spec
index c1c4eda..8eb2ffb 100644
--- a/libreoffice.spec
+++ b/libreoffice.spec
@@ -270,6 +270,7 @@ Patch30: 0001-Resolves-rhbz-1010995-div-by-0-on-some-bizarre-corne.patch
Patch31: 0001-Related-rhbz-1065807-rework-i66157-for-multiple-writ.patch
Patch32: 0001-Resolves-rhbz-1065807-use-xdg-Templates-for-default-.patch
Patch33: 0001-explictly-list-common-lang-independant-template-dir.patch
+Patch34: 0001-rhbz-1057977-avoid-use-of-invalidated-pointers.patch
%define instdir %{_libdir}
%define baseinstdir %{instdir}/libreoffice
@@ -1067,6 +1068,7 @@ mv -f redhat.soc extras/source/palettes/standard.soc
%patch31 -p1 -b .rhbz-1065807-rework-i66157-for-multiple-writ.patch
%patch32 -p1 -b .rhbz-1065807-use-xdg-Templates-for-default-.patch
%patch33 -p1 -b .explictly-list-common-lang-independant-template-dir.patch
+%patch34 -p1 -b .rhbz-1057977-avoid-use-of-invalidated-pointers.patch
# TODO: check this
# these are horribly incomplete--empty translations and copied english
@@ -2164,6 +2166,7 @@ update-desktop-database %{_datadir}/applications &> /dev/null || :
%changelog
* Tue Feb 25 2014 Caolán McNamara <caolanm at redhat.com> - 1:4.1.5.3-3-UNBUILT
- Resolves: rhbz#1065807 search XDG defined "Templates"
+- Resolves: rhbz#1057977 do not crash when fonts are updated
* Tue Feb 18 2014 David Tardon <dtardon at redhat.com> - 1:4.1.5.3-2
- Resolves: rhbz#1065925 [abrt] libreoffice-core: Divide(): soffice.bin killed
More information about the scm-commits
mailing list