summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@behdad.org>2014-08-10 19:22:58 -0400
committerBehdad Esfahbod <behdad@behdad.org>2014-08-10 19:22:58 -0400
commit729e7678cd6a691e6a423c716bda55177c540de7 (patch)
tree20feda54e341536691458b32c82970c1dab7d431
parent051aa4844b9e60cbeae0e6088aa33d192de06621 (diff)
downloadpango-729e7678cd6a691e6a423c716bda55177c540de7.tar.gz
[coretext] Bug 734174 Crashes on OS Yosemite
-rw-r--r--modules/basic/basic-coretext.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/modules/basic/basic-coretext.c b/modules/basic/basic-coretext.c
index 9e087bab..4914200e 100644
--- a/modules/basic/basic-coretext.c
+++ b/modules/basic/basic-coretext.c
@@ -93,6 +93,7 @@ struct RunIterator
CTRunRef current_run;
CFIndex *current_indices;
const CGGlyph *current_cgglyphs;
+ CGGlyph *current_cgglyphs_buffer;
CTRunStatus current_run_status;
};
@@ -102,6 +103,9 @@ run_iterator_free_current_run (struct RunIterator *iter)
iter->current_run_number = -1;
iter->current_run = NULL;
iter->current_cgglyphs = NULL;
+ if (iter->current_cgglyphs_buffer)
+ free (iter->current_cgglyphs_buffer);
+ iter->current_cgglyphs_buffer = NULL;
if (iter->current_indices)
free (iter->current_indices);
iter->current_indices = NULL;
@@ -117,10 +121,18 @@ run_iterator_set_current_run (struct RunIterator *iter,
iter->current_run_number = run_number;
iter->current_run = CFArrayGetValueAtIndex (iter->runs, run_number);
+ ct_glyph_count = CTRunGetGlyphCount (iter->current_run);
+
iter->current_run_status = CTRunGetStatus (iter->current_run);
iter->current_cgglyphs = CTRunGetGlyphsPtr (iter->current_run);
+ if (!iter->current_cgglyphs)
+ {
+ iter->current_cgglyphs_buffer = (CGGlyph *)malloc (sizeof (CGGlyph) * ct_glyph_count);
+ CTRunGetGlyphs (iter->current_run, CFRangeMake (0, ct_glyph_count),
+ iter->current_cgglyphs_buffer);
+ iter->current_cgglyphs = iter->current_cgglyphs_buffer;
+ }
- ct_glyph_count = CTRunGetGlyphCount (iter->current_run);
iter->current_indices = malloc (sizeof (CFIndex *) * ct_glyph_count);
CTRunGetStringIndices (iter->current_run, CFRangeMake (0, ct_glyph_count),
iter->current_indices);
@@ -205,6 +217,7 @@ run_iterator_create (struct RunIterator *iter,
iter->current_run = NULL;
iter->current_indices = NULL;
iter->current_cgglyphs = NULL;
+ iter->current_cgglyphs_buffer = NULL;
/* Create CTLine */
attributes = CFDictionaryCreate (kCFAllocatorDefault,