diff options
author | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2017-09-28 09:16:02 +0900 |
---|---|---|
committer | Carsten Haitzler (Rasterman) <raster@rasterman.com> | 2017-09-28 15:28:00 +0900 |
commit | bee7bf5767f5dc83eba88d740b1a729ca7077b9b (patch) | |
tree | af56eeea89a169caa654f0c97ba4aa00947e23fa | |
parent | e095562ea1da6ddb9de40882d9345be9bcc6223f (diff) |
efl ui text - fix resource leak of strbuf and pointless buffer code
edje_object_part_text_style_user_push() doesnt need you to
stringshare_add a string... some other code did it because it "gets"
the string from an obj that might free/delete the string on push etc.
or before so it keeps a copy but then it stringshare_del's it
anyway... the _textpath_ellipsis_set() code creates a trsbuf that
wasn't freed if enabled was false and it never stringshare_del'd the
string is stringshare_added... all of this was pointless code anyway.
you could just pass the constant string directly.
fixes CID 1380543
Diffstat (limited to '')
-rw-r--r-- | src/lib/elementary/efl_ui_textpath.c | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/src/lib/elementary/efl_ui_textpath.c b/src/lib/elementary/efl_ui_textpath.c index 22883f2d01..722dbe305d 100644 --- a/src/lib/elementary/efl_ui_textpath.c +++ b/src/lib/elementary/efl_ui_textpath.c | |||
@@ -410,17 +410,11 @@ _sizing_eval(Efl_Ui_Textpath_Data *pd) | |||
410 | static void | 410 | static void |
411 | _textpath_ellipsis_set(Efl_Ui_Textpath_Data *pd, Eina_Bool enabled) | 411 | _textpath_ellipsis_set(Efl_Ui_Textpath_Data *pd, Eina_Bool enabled) |
412 | { | 412 | { |
413 | Eina_Strbuf *buf = eina_strbuf_new(); | ||
414 | const char *format; | ||
415 | |||
416 | edje_object_part_text_style_user_pop(pd->text_obj, "elm.text"); | 413 | edje_object_part_text_style_user_pop(pd->text_obj, "elm.text"); |
414 | |||
417 | if (enabled) | 415 | if (enabled) |
418 | { | 416 | edje_object_part_text_style_user_push(pd->text_obj, "elm.text", |
419 | eina_strbuf_append_printf(buf, "DEFAULT='ellipsis=1.0'"); | 417 | "DEFAULT='ellipsis=1.0'"); |
420 | format = eina_stringshare_add(eina_strbuf_string_get(buf)); | ||
421 | eina_strbuf_free(buf); | ||
422 | edje_object_part_text_style_user_push(pd->text_obj, "elm.text", format); | ||
423 | } | ||
424 | } | 418 | } |
425 | 419 | ||
426 | static void | 420 | static void |