forked from enlightenment/efl
entry: NULL should be set to the correct position of tmpbuf.
If edje_object_part_text_get gives different text from original one, length of text can be changed. So the last position of tmpbuf should be calculated again refering to the current text to be returned.
This commit is contained in:
parent
068c9a095f
commit
6eb6f805ba
|
@ -2829,12 +2829,12 @@ proceed:
|
||||||
if (sd->append_text_len > 0)
|
if (sd->append_text_len > 0)
|
||||||
{
|
{
|
||||||
char *tmpbuf;
|
char *tmpbuf;
|
||||||
size_t tlen;
|
size_t len, tlen;
|
||||||
|
|
||||||
tlen = strlen(text);
|
tlen = strlen(text);
|
||||||
|
len = tlen + sd->append_text_len - sd->append_text_position;
|
||||||
/* FIXME: need that or we do copy uninitialised data */
|
/* FIXME: need that or we do copy uninitialised data */
|
||||||
tmpbuf = calloc(1, tlen + sd->append_text_len -
|
tmpbuf = calloc(1, len + 1);
|
||||||
sd->append_text_position + 1);
|
|
||||||
if (!tmpbuf)
|
if (!tmpbuf)
|
||||||
{
|
{
|
||||||
ERR("Failed to allocate memory for entry's text %p", obj);
|
ERR("Failed to allocate memory for entry's text %p", obj);
|
||||||
|
@ -2846,7 +2846,7 @@ proceed:
|
||||||
memcpy(tmpbuf + tlen, sd->append_text_left
|
memcpy(tmpbuf + tlen, sd->append_text_left
|
||||||
+ sd->append_text_position, sd->append_text_len
|
+ sd->append_text_position, sd->append_text_len
|
||||||
- sd->append_text_position);
|
- sd->append_text_position);
|
||||||
tmpbuf[sd->append_text_len] = '\0';
|
tmpbuf[len] = '\0';
|
||||||
eina_stringshare_replace(&sd->text, tmpbuf);
|
eina_stringshare_replace(&sd->text, tmpbuf);
|
||||||
free(tmpbuf);
|
free(tmpbuf);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue