[Libreoffice-commits] core.git: Branch 'libreoffice-4-0' - vcl/generic

Eike Rathke erack at redhat.com
Mon May 6 04:28:19 PDT 2013


 vcl/generic/glyphs/gcach_layout.cxx |   15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

New commits:
commit d7676d33f16bf790b35c06b5710f326254387cdc
Author: Eike Rathke <erack at redhat.com>
Date:   Fri May 3 00:19:59 2013 +0200

    adapt to ICU patch https://ssl.icu-project.org/trac/ticket/10107
    
    do not call LayoutEngine::reset()
    
    Calling reset() disposes everything the LayoutEngine knows in its
    current state. While this may have prevented some obscure crash during
    exit in the past (call was added 2003-03-27), it definitely leads to a
    crash if the updated LayoutEngine "patch"
    http://download.icu-project.org/files/icu4c/51.1/icu-51-layout-fix-10107.tgz
    is applied as that sets fGlyphStorage=NULL (it doesn't delete
    LEGlyphStorage though and thus may leak, but that patch is in the wild
    now) and a later call to mpIcuLE->layoutChars() tries to access
    fGlyphStorage->...() if mpIcuLE is reused.
    
    For the patch mentioned see
    http://site.icu-project.org/download/51#TOC-Known-Issues and
    http://bugs.icu-project.org/trac/ticket/10107
    
    Change-Id: I1b8f5c446c174d7d12b896b3ecd2a266645e8abc
    (cherry picked from commit 7de7267f4cfcb455aabb09053c7ed681d4591867)
    
    implemented IcuFontFromServerFont::getFontTable(LETag,size_t&)
    
    so that ICU versions trying to call
    LEFontInstance::getFontTable(LETag,size_t&) actually call it instead of
    IcuFontFromServerFont::getFontTable(LETag)
    
    See http://site.icu-project.org/download/51#TOC-Known-Issues
    "NOTE: Applications must implement LEFontInstance::getFontTable(LETag,
    size_t &length)  in their LEFontInstance subclasses, so that ICU can
    properly bounds-check font tables."
    
    See also https://ssl.icu-project.org/trac/ticket/10107
    
    (cherry picked from commit 428bde3591ff2fd2195097040dbe1480f1f4210f)
    
    Conflicts:
    	vcl/generic/glyphs/gcach_layout.cxx
    
    Change-Id: Ic20b7e8dda4e84734eb6de0ccba82b0dea481d55
    Reviewed-on: https://gerrit.libreoffice.org/3755
    Reviewed-by: Miklos Vajna <vmiklos at suse.cz>
    Tested-by: Miklos Vajna <vmiklos at suse.cz>

diff --git a/vcl/generic/glyphs/gcach_layout.cxx b/vcl/generic/glyphs/gcach_layout.cxx
index a9f373e..f0d38c6 100644
--- a/vcl/generic/glyphs/gcach_layout.cxx
+++ b/vcl/generic/glyphs/gcach_layout.cxx
@@ -103,6 +103,7 @@ public:
                             : mrServerFont( rFont )
                             {}
 
+    virtual const void*     getFontTable(LETag tableTag, size_t &length) const;
     virtual const void*     getFontTable(LETag tableTag) const;
     virtual le_int32        getUnitsPerEM() const;
     virtual float           getXPixelsPerEm() const;
@@ -124,7 +125,7 @@ public:
 
 // -----------------------------------------------------------------------
 
-const void* IcuFontFromServerFont::getFontTable( LETag nICUTableTag ) const
+const void* IcuFontFromServerFont::getFontTable( LETag nICUTableTag, size_t & rLength ) const
 {
     char pTagName[5];
     pTagName[0] = (char)(nICUTableTag >> 24);
@@ -133,9 +134,10 @@ const void* IcuFontFromServerFont::getFontTable( LETag nICUTableTag ) const
     pTagName[3] = (char)(nICUTableTag);
     pTagName[4] = 0;
 
-    sal_uLong nLength;
+    sal_uLong nLength = 0;
     const unsigned char* pBuffer = mrServerFont.GetTable( pTagName, &nLength );
-    SAL_INFO("vcl", "IcuGetTable(\"" << pTagName << "\") => " << pBuffer);
+    rLength = static_cast<size_t>(nLength);
+    SAL_INFO("vcl", "IcuGetTable(\"" << pTagName << "\") => " << pBuffer << ", len=" << rLength);
     SAL_INFO(
         "vcl",
         "font( h=" << mrServerFont.GetFontSelData().mnHeight << ", \""
@@ -143,6 +145,12 @@ const void* IcuFontFromServerFont::getFontTable( LETag nICUTableTag ) const
     return pBuffer;
 }
 
+const void* IcuFontFromServerFont::getFontTable( LETag nICUTableTag ) const
+{
+    size_t nLength = 0;
+    return getFontTable( nICUTableTag, nLength);
+}
+
 // -----------------------------------------------------------------------
 
 le_int32 IcuFontFromServerFont::getUnitsPerEM() const
@@ -412,7 +420,6 @@ bool IcuLayoutEngine::layout(ServerFontLayout& rLayout, ImplLayoutArgs& rArgs)
         mpIcuLE->getGlyphs( pIcuGlyphs, rcIcu );
         mpIcuLE->getCharIndices( pCharIndices, rcIcu );
         mpIcuLE->getGlyphPositions( &pGlyphPositions->fX, rcIcu );
-        mpIcuLE->reset(); // TODO: get rid of this, PROBLEM: crash at exit when removed
         if( LE_FAILURE(rcIcu) )
             return false;
 


More information about the Libreoffice-commits mailing list