[Libreoffice-commits] core.git: Branch 'libreoffice-4-1' - vcl/coretext
Tor Lillqvist
tml at iki.fi
Thu Aug 8 04:58:18 PDT 2013
vcl/coretext/ctlayout.cxx | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
New commits:
commit 20b5932eb6f16b3674592977db56a29fb35ef6f7
Author: Tor Lillqvist <tml at iki.fi>
Date: Tue Aug 6 11:55:14 2013 +0300
fdo#67660: Fix memory mismanagement crash
The CTLayout constructor called CFRetain() on the associated
CTTextStyle's attribute directory (a CFMutableDictionaryRef) and the
destructor then called CFRelease() on it, even if there was no
guarantee it was still the same CTTextStyle. And in the scenario that
caused this crash, AquaSalGraphics::SetFont() had in fact deleted the
original CTTextStyle and created a new one.
It seems to me that these CFRetain() and CFRelease() calls are not
necessary.
Change-Id: I18e03965dd05d450955353f8c48f111c19a069e3
Reviewed-on: https://gerrit.libreoffice.org/5293
Reviewed-by: Norbert Thiebaud <nthiebaud at gmail.com>
Tested-by: Norbert Thiebaud <nthiebaud at gmail.com>
diff --git a/vcl/coretext/ctlayout.cxx b/vcl/coretext/ctlayout.cxx
index 437f7fc..743d66f 100644
--- a/vcl/coretext/ctlayout.cxx
+++ b/vcl/coretext/ctlayout.cxx
@@ -80,7 +80,6 @@ CTLayout::CTLayout( const CTTextStyle* pTextStyle )
, mfCachedWidth( -1 )
, mfBaseAdv( 0 )
{
- CFRetain( mpTextStyle->GetStyleDict() );
}
// -----------------------------------------------------------------------
@@ -91,7 +90,6 @@ CTLayout::~CTLayout()
CFRelease( mpCTLine );
if( mpAttrString )
CFRelease( mpAttrString );
- CFRelease( mpTextStyle->GetStyleDict() );
}
// -----------------------------------------------------------------------
@@ -114,6 +112,7 @@ bool CTLayout::LayoutText( ImplLayoutArgs& rArgs )
// create the CoreText line layout
CFStringRef aCFText = CFStringCreateWithCharactersNoCopy( NULL, rArgs.mpStr + mnMinCharPos, mnCharCount, kCFAllocatorNull );
+ // CFAttributedStringCreate copies the attribues parameter
mpAttrString = CFAttributedStringCreate( NULL, aCFText, mpTextStyle->GetStyleDict() );
mpCTLine = CTLineCreateWithAttributedString( mpAttrString );
CFRelease( aCFText);
More information about the Libreoffice-commits
mailing list