[Tizen] fixed crash issue 89/192189/1
authorJoogab Yun <joogab.yun@samsung.com>
Tue, 23 Oct 2018 08:09:09 +0000 (17:09 +0900)
committerJoogab Yun <joogab.yun@samsung.com>
Wed, 31 Oct 2018 09:54:23 +0000 (18:54 +0900)
If colorsBuffer and colorIndexBuffer are null, then crash occurs.
so if useDefaultColor is true, colorIndex must be 0u.

(gdb)bt full
 #5  Dali::Toolkit::Text::Typesetter::CreateImageBuffer
(this=this@entry=0x9b9f78, bufferWidth=bufferWidth@entry=166,
bufferHeight=bufferHeight@entry=38,
style=style@entry=Dali::Toolkit::Text::Typesetter::STYLE_NONE,
ignoreHorizontalAlignment=ignoreHorizontalAlignment@entry=true,
pixelFormat=pixelFormat@entry=Dali::Pixel::RGBA8888,
horizontalOffset=<optimized out>, horizontalOffset@entry=0,
verticalOffset=<optimized out>, verticalOffset@entry=0,
fromGlyphIndex=<optimized out>, fromGlyphIndex@entry=0,
toGlyphIndex=<optimized out>, toGlyphIndex@entry=5) at
/usr/src/debug/dali-toolkit-1.3.41/build/tizen/dali-toolkit/../../../dali-toolkit/internal/text/rendering/text-typesetter.cpp:640
         color = <optimized out>
         glyphInfo = 0x90ab28
         position = 0x964330
         glyphIndex = 0
         line = @0x83d4f0: {glyphRun = {glyphIndex = 0, numberOfGlyphs =
6}, characterRun = {characterIndex = 0, numberOfCharacters = 6}, width =
115, ascender = 28, descender = -9, extraLength = 0, alignmentOffset =
0, lineSpacing = 0, direction = false, ellipsis = false}
         outlineWidth = 0
         currentUnderlinePosition = <optimized out>
         currentUnderlineThickness = 0
         lastUnderlinedFontId = 0
         underlineEnabled = false
         lineExtentLeft = 2
         lineExtentRight = 21
         baseline = 0
         underlineHeight = 0
         underlineColor = @0x8e0358: {static ONE = {static ONE = <same
as static member of an already seen type>, static XAXIS = {static ONE =
<same as static member of an already seen type>, static XAXIS = <same as
static member of an already seen type>, static YAXIS = {static ONE =
<same as static member of an already seen type>, static XAXIS = <same as
static member of an already seen type>, static YAXIS = <same as static
member of an already seen type>, static ZAXIS = {static ONE = <same as
static member of an already seen type>, static XAXIS = <same as static
member of an already seen type>, static YAXIS = <same as static member
of an already seen type>, static ZAXIS = <same as static member of an
already seen type>, static ZERO = {static ONE = <same as static member
of an already seen type>, static XAXIS = <same as static member of an
already seen type>, static YAXIS = <same as static member of an already
seen type>, static ZAXIS = <same as static member of an already seen
type>, static ZERO = <same as static member of an already seen type>, {x
= 0, r = 0, s = 0}, {y = 0, g = 0, t = 0}, {z = 0, b = 0, p = 0}, {w =
0, a = 0, q = 0}}, {x = 0, r = 0, s = 0}, {y = 0, g = 0, t = 0}, {z = 1,
b = 1, p = 1}, {w = 0, a = 0, q = 0}}, static ZERO = <same as static
member of an already seen type>, {x = 0, r = 0, s = 0}, {y = 1, g = 1, t
= 1}, {z = 0, b = 0, p = 0}, {w = 0, a = 0, q = 0}}, static ZAXIS =
<same as static member of an already seen type>, static ZERO = <same as
static member of an already seen type>, {x = 1, r = 1, s = 1}, {y = 0, g
= 0, t = 0}, {z = 0, b = 0, p = 0}, {w = 0, a = 0, q = 0}}, static YAXIS
= <same as static member of an already seen type>, static ZAXIS = <same
as static member of an already seen type>, static ZERO = <same as static
member of an already seen type>, {x = 1, r = 1, s = 1}, {y = 1, g = 1, t
= 1}, {z = 1, b = 1, p = 1}, {w = 1, a = 1, q = 1}}, static XAXIS =
<same as static member of an already seen type>, static YAXIS = <same as
static member of an already seen type>, static ZAXIS = <same as static
member of an already seen type>, static ZERO = <same as static member of
an already seen type>, {x = 1, r = 1, s = 1}, {y = 1, g = 1, t = 1}, {z
= 1, b = 1, p = 1}, {w = 1, a = 1, q = 1}}
         numberOfUnderlineRuns = <optimized out>
         underlineRuns = {<Dali::VectorAlgorithms<true>> =
{<Dali::VectorBase> = {mData = 0x0}, <No data fields>}, <No data
fields>}
         thereAreUnderlinedGlyphs = <optimized out>
         maxUnderlineThickness = 0
         lineIndex = 0
         modelNumberOfLines = 1
         modelLinesBuffer = <optimized out>
         numberOfGlyphs = 6
         glyphsBuffer = 0x90ab28
         positionBuffer = 0x964330
         colorsBuffer = 0x0
         colorIndexBuffer = 0x0
         useDefaultColor = true
         defaultColor = @0x8e0338: {static ONE = {static ONE = <same as
static member of an already seen type>, static XAXIS = {static ONE =
<same as static member of an already seen type>, static XAXIS = <same as
static member of an already seen type>, static YAXIS = {static ONE =
<same as static member of an already seen type>, static XAXIS = <same as
static member of an already seen type>, static YAXIS = <same as static
member of an already seen type>, static ZAXIS = {static ONE = <same as
static member of an already seen type>, static XAXIS = <same as static
member of an already seen type>, static YAXIS = <same as static member
of an already seen type>, static ZAXIS = <same as static member of an
already seen type>, static ZERO = {static ONE = <same as static member
of an already seen type>, static XAXIS = <same as static member of an
already seen type>, static YAXIS = <same as static member of an already
seen type>, static ZAXIS = <same as static member of an already seen
type>, static ZERO = <same as static member of an already seen type>, {x
= 0, r = 0, s = 0}, {y = 0, g = 0, t = 0}, {z = 0, b = 0, p = 0}, {w =
0, a = 0, q = 0}}, {x = 0, r = 0, s = 0}, {y = 0, g = 0, t = 0}, {z = 1,
b = 1, p = 1}, {w = 0, a = 0, q = 0}}, static ZERO = <same as static
member of an already seen type>, {x = 0, r = 0, s = 0}, {y = 1, g = 1, t
= 1}, {z = 0, b = 0, p = 0}, {w = 0, a = 0, q = 0}}, static ZAXIS =
<same as static member of an already seen type>, static ZERO = <same as
static member of an already seen type>, {x = 1, r = 1, s = 1}, {y = 0, g
= 0, t = 0}, {z = 0, b = 0, p = 0}, {w = 0, a = 0, q = 0}}, static YAXIS
= <same as static member of an already seen type>, static ZAXIS = <same
as static member of an already seen type>, static ZERO = <same as static
member of an already seen type>, {x = 1, r = 1, s = 1}, {y = 1, g = 1, t
= 1}, {z = 1, b = 1, p = 1}, {w = 1, a = 1, q = 1}}, static XAXIS =
<same as static member of an already seen type>, static YAXIS = <same as
static member of an already seen type>, static ZAXIS = <same as static
member of an already seen type>, static ZERO = <same as static member of
an already seen type>, {x = 1, r = 1, s = 1}, {y = 1, g = 1, t = 1}, {z
= 1, b = 1, p = 1}, {w = 1, a = 1, q = 1}}
         glyphData = {bitmapBuffer = {<Dali::BaseHandle> =
{mObjectHandle = {mPtr = 0x9b9f48}}, <No data fields>}, position = 0x6,
glyphBitmap = {buffer = 0x0, width = 0, height = 0, format =
Dali::Pixel::A8}, width = 166, height = 38, horizontalOffset = 0,
verticalOffset = 28}
         fontClient = {<Dali::BaseHandle> = {mObjectHandle = {mPtr =
0x72bfd0}}, static DEFAULT_POINT_SIZE = 1767076981}

Change-Id: Ia68a0409afecb8c008ccade6e1ce75334bb92ab2

dali-toolkit/internal/text/rendering/text-typesetter.cpp

index 0e149d7..8018054 100755 (executable)
@@ -637,7 +637,7 @@ Devel::PixelBuffer Typesetter::CreateImageBuffer( const unsigned int bufferWidth
       }
 
       // Retrieves the glyph's color.
-      const ColorIndex colorIndex = *( colorIndexBuffer + glyphIndex );
+      const ColorIndex colorIndex = useDefaultColor ? 0u : *( colorIndexBuffer + glyphIndex );
 
       Vector4 color;
       if ( style == Typesetter::STYLE_SHADOW )