diff options
author | Owen Taylor <otaylor@redhat.com> | 2003-02-12 21:55:44 +0000 |
---|---|---|
committer | Owen Taylor <otaylor@src.gnome.org> | 2003-02-12 21:55:44 +0000 |
commit | 32134ad968742529b13f39003b909dc906e4fa72 (patch) | |
tree | cab1ed05a3f224eedff7f5357e6363d2dfc90f3d | |
parent | 349b615db0161d2524c0b53981ec0085fe83b7d0 (diff) | |
download | pango-32134ad968742529b13f39003b909dc906e4fa72.tar.gz |
Guard against pango_layout_set_text (pango_layout_get_text (layout));
Wed Feb 12 16:48:46 2003 Owen Taylor <otaylor@redhat.com>
* pango/pango-layout.c (pango_layout_set_text):
Guard against
pango_layout_set_text (pango_layout_get_text (layout));
(#105612, Morten Welinder)
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | ChangeLog.pre-1-10 | 7 | ||||
-rw-r--r-- | ChangeLog.pre-1-4 | 7 | ||||
-rw-r--r-- | ChangeLog.pre-1-6 | 7 | ||||
-rw-r--r-- | ChangeLog.pre-1-8 | 7 | ||||
-rw-r--r-- | pango/pango-layout.c | 11 |
6 files changed, 42 insertions, 4 deletions
@@ -1,3 +1,10 @@ +Wed Feb 12 16:48:46 2003 Owen Taylor <otaylor@redhat.com> + + * pango/pango-layout.c (pango_layout_set_text): + Guard against + pango_layout_set_text (pango_layout_get_text (layout)); + (#105612, Morten Welinder) + Wed Feb 12 16:44:05 2003 Owen Taylor <otaylor@redhat.com> * examples/viewer-qt.cc: Remove call to diff --git a/ChangeLog.pre-1-10 b/ChangeLog.pre-1-10 index 06165246..cdf6807a 100644 --- a/ChangeLog.pre-1-10 +++ b/ChangeLog.pre-1-10 @@ -1,3 +1,10 @@ +Wed Feb 12 16:48:46 2003 Owen Taylor <otaylor@redhat.com> + + * pango/pango-layout.c (pango_layout_set_text): + Guard against + pango_layout_set_text (pango_layout_get_text (layout)); + (#105612, Morten Welinder) + Wed Feb 12 16:44:05 2003 Owen Taylor <otaylor@redhat.com> * examples/viewer-qt.cc: Remove call to diff --git a/ChangeLog.pre-1-4 b/ChangeLog.pre-1-4 index 06165246..cdf6807a 100644 --- a/ChangeLog.pre-1-4 +++ b/ChangeLog.pre-1-4 @@ -1,3 +1,10 @@ +Wed Feb 12 16:48:46 2003 Owen Taylor <otaylor@redhat.com> + + * pango/pango-layout.c (pango_layout_set_text): + Guard against + pango_layout_set_text (pango_layout_get_text (layout)); + (#105612, Morten Welinder) + Wed Feb 12 16:44:05 2003 Owen Taylor <otaylor@redhat.com> * examples/viewer-qt.cc: Remove call to diff --git a/ChangeLog.pre-1-6 b/ChangeLog.pre-1-6 index 06165246..cdf6807a 100644 --- a/ChangeLog.pre-1-6 +++ b/ChangeLog.pre-1-6 @@ -1,3 +1,10 @@ +Wed Feb 12 16:48:46 2003 Owen Taylor <otaylor@redhat.com> + + * pango/pango-layout.c (pango_layout_set_text): + Guard against + pango_layout_set_text (pango_layout_get_text (layout)); + (#105612, Morten Welinder) + Wed Feb 12 16:44:05 2003 Owen Taylor <otaylor@redhat.com> * examples/viewer-qt.cc: Remove call to diff --git a/ChangeLog.pre-1-8 b/ChangeLog.pre-1-8 index 06165246..cdf6807a 100644 --- a/ChangeLog.pre-1-8 +++ b/ChangeLog.pre-1-8 @@ -1,3 +1,10 @@ +Wed Feb 12 16:48:46 2003 Owen Taylor <otaylor@redhat.com> + + * pango/pango-layout.c (pango_layout_set_text): + Guard against + pango_layout_set_text (pango_layout_get_text (layout)); + (#105612, Morten Welinder) + Wed Feb 12 16:44:05 2003 Owen Taylor <otaylor@redhat.com> * examples/viewer-qt.cc: Remove call to diff --git a/pango/pango-layout.c b/pango/pango-layout.c index 2df1cbbb..a2234189 100644 --- a/pango/pango-layout.c +++ b/pango/pango-layout.c @@ -722,11 +722,14 @@ pango_layout_set_text (PangoLayout *layout, const char *text, int length) { - const gchar *end; + const char *end; + char *old_text; g_return_if_fail (layout != NULL); g_return_if_fail (length == 0 || text != NULL); + old_text = layout->text; + if (length != 0) { if (!g_utf8_validate (text, length, &end)) @@ -735,9 +738,6 @@ pango_layout_set_text (PangoLayout *layout, length = end - text; } - if (layout->text) - g_free (layout->text); - /* NULL-terminate the text for convenience. */ layout->text = g_malloc (length + 1); @@ -748,6 +748,9 @@ pango_layout_set_text (PangoLayout *layout, layout->length = length; pango_layout_clear_lines (layout); + + if (old_text) + g_free (old_text); } /** |