diff options
author | Behdad Esfahbod <behdad@behdad.org> | 2009-04-06 19:49:02 -0400 |
---|---|---|
committer | Behdad Esfahbod <behdad@behdad.org> | 2009-04-06 22:32:37 -0400 |
commit | dd6ce709db5872132335fef9f75aa16a33d6e5aa (patch) | |
tree | 325cbe38e6420fd26e1a1cf85551eb8a3f403b49 /pango | |
parent | b6b9a22500c3e760f7c05d6c1fd62ff1529dee1b (diff) | |
download | pango-dd6ce709db5872132335fef9f75aa16a33d6e5aa.tar.gz |
[layout] Truncate final whitespace in the line before ellipsizing
Bug 556132 – gnome-panel crashed with SIGSEGV in
g_cclosure_marshal_VOID__BOXED()
Not after. Also fixes invalid memory access in case line was both
wrapped and ellipsized.
Diffstat (limited to 'pango')
-rw-r--r-- | pango/pango-layout.c | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/pango/pango-layout.c b/pango/pango-layout.c index b1b75a4f..4326eb47 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -5166,18 +5166,21 @@ pango_layout_line_postprocess (PangoLayoutLine *line, ParaBreakState *state, gboolean wrapped) { - PangoLayoutRun *last_run = line->runs->data; gboolean ellipsized = FALSE; - /* NB: the runs are in reverse order at this point, since we prepended them to the list + DEBUG ("postprocessing", line, state); + + /* Truncate the logical-final whitespace in the line if we broke the line at it */ + if (wrapped) + /* The runs are in reverse order at this point, since we prepended them to the list. + * So, the first run is the last logical run. */ + zero_line_final_space (line, state, line->runs->data); /* Reverse the runs */ line->runs = g_slist_reverse (line->runs); - DEBUG ("postprocessing", line, state); - /* Ellipsize the line if necessary */ if (G_UNLIKELY (state->line_width >= 0 && @@ -5186,11 +5189,6 @@ pango_layout_line_postprocess (PangoLayoutLine *line, ellipsized = _pango_layout_line_ellipsize (line, state->attrs, state->line_width); } - /* Truncate the logical-final whitespace in the line if we broke the line at it - */ - if (wrapped) - zero_line_final_space (line, state, last_run); - DEBUG ("after removing final space", line, state); /* Now convert logical to visual order |