HomePhabricator

Revert command line array object because it's broken by design

Authored by raster on Feb 12 2019, 11:54 AM.

Description

Revert command line array object because it's broken by design

Revert "ecore: get rid of commands in efl_task."

This reverts commit 616381e9cfed41b83fef039b0e38c09b41fd3d7f.

Revert "ecore: here comes a command line object"

This reverts commit 48e5684b3c37b337edd7004e68fc0690b58a84e6.
  1. this is broken:

EOLIAN static const char*
_efl_core_command_line_command_get(const Eo *obj EINA_UNUSED, Efl_Core_Command_Line_Data *pd)
{

return eina_strdup(pd->string_command);

}

it returns a const char * BUT it duplicates it on return. no. a big
fat honking NO. return a char * or don't duplicate. pick.

  1. _efl_core_command_line_command_array_set() is broken by design. it

accepts an array of strings, but the strings are owned by the caller
who creates the array (requiring they free them up themselves after
this call) but the array becomes owned by the callee. the code here frees the
incoming array but doesn't care about the string content of it. it's
leak heaven waiting to happen (or bugs when someone wants to access
the array they create to walk it to free the strings they put into it
after it is set).

i brought this up and it was dismissed. now exactly he issue i brought
up is there with mixed ownership and the added complexity as well as
transfer of some ownership but not others.

go back and think about this so it isn't broken by design.