diff options
author | Dominique Bureau <burdo@touchtunes.com> | 2012-05-11 13:26:50 -0400 |
---|---|---|
committer | Emmanuele Bassi <ebassi@linux.intel.com> | 2012-05-25 15:13:24 +0100 |
commit | 95f17f28af89cfcb7eabab7e384f23828e5b5c19 (patch) | |
tree | 0cd5bd921da519322f186c2c51e15ce3e656b1c2 | |
parent | eb811210e25a2bcc7b9fa8b2ac8b113230e014e9 (diff) | |
download | clutter-95f17f28af89cfcb7eabab7e384f23828e5b5c19.tar.gz |
ClutterText: Cannot pass NULL string to clutter_text_set_text()
Passing a NULL buffer to clutter_text_set_text() does not behave the same
way as passing an empty string "" (as specified in the documentation).
This was working as expected previously, but somehow the behaviour changed
at some point and created 2 new issues:
- Passing a NULL pointer will not reset the string
- If the ClutterText is editable, it will segfault in strcmp
Validations have been added to prevent this.
https://bugzilla.gnome.org/show_bug.cgi?id=675890
-rw-r--r-- | clutter/clutter-text.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/clutter/clutter-text.c b/clutter/clutter-text.c index 2dd12ea9e..ea05aa64f 100644 --- a/clutter/clutter-text.c +++ b/clutter/clutter-text.c @@ -4767,12 +4767,12 @@ clutter_text_set_text (ClutterText *self, */ if (self->priv->editable) { - if (strcmp (clutter_text_buffer_get_text (get_buffer (self)), text) == 0) + if (g_strcmp0 (clutter_text_buffer_get_text (get_buffer (self)), text) == 0) return; } clutter_text_set_use_markup_internal (self, FALSE); - clutter_text_buffer_set_text (get_buffer (self), text, -1); + clutter_text_buffer_set_text (get_buffer (self), text ? text : "", -1); } /** |