forked from enlightenment/efl
efl core cmommand line - implement destructor and thus fix leak
This commit is contained in:
parent
38be95b0b6
commit
e51699afbc
|
@ -203,6 +203,16 @@ _remove_invalid_chars(char *command)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_clear_command(Efl_Core_Command_Line_Data *pd)
|
||||||
|
{
|
||||||
|
if (!pd->command) return;
|
||||||
|
while (eina_array_count(pd->command) > 0)
|
||||||
|
eina_stringshare_del(eina_array_pop(pd->command));
|
||||||
|
eina_array_free(pd->command);
|
||||||
|
pd->command = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
EOLIAN static Eina_Bool
|
EOLIAN static Eina_Bool
|
||||||
_efl_core_command_line_command_array_set(Eo *obj EINA_UNUSED, Efl_Core_Command_Line_Data *pd, Eina_Array *array)
|
_efl_core_command_line_command_array_set(Eo *obj EINA_UNUSED, Efl_Core_Command_Line_Data *pd, Eina_Array *array)
|
||||||
{
|
{
|
||||||
|
@ -210,6 +220,7 @@ _efl_core_command_line_command_array_set(Eo *obj EINA_UNUSED, Efl_Core_Command_L
|
||||||
Eina_Strbuf *command = eina_strbuf_new();
|
Eina_Strbuf *command = eina_strbuf_new();
|
||||||
unsigned int i = 0;
|
unsigned int i = 0;
|
||||||
|
|
||||||
|
_clear_command(pd);
|
||||||
pd->command = eina_array_new(array ? eina_array_count(array) : 0);
|
pd->command = eina_array_new(array ? eina_array_count(array) : 0);
|
||||||
for (i = 0; i < (array ? eina_array_count(array) : 0); ++i)
|
for (i = 0; i < (array ? eina_array_count(array) : 0); ++i)
|
||||||
{
|
{
|
||||||
|
@ -219,7 +230,6 @@ _efl_core_command_line_command_array_set(Eo *obj EINA_UNUSED, Efl_Core_Command_L
|
||||||
|
|
||||||
if (!param)
|
if (!param)
|
||||||
{
|
{
|
||||||
free(param);
|
|
||||||
while (eina_array_count(pd->command) > 0)
|
while (eina_array_count(pd->command) > 0)
|
||||||
eina_stringshare_del(eina_array_pop(pd->command));
|
eina_stringshare_del(eina_array_pop(pd->command));
|
||||||
eina_array_free(pd->command);
|
eina_array_free(pd->command);
|
||||||
|
@ -276,4 +286,11 @@ _efl_core_command_line_command_string_set(Eo *obj EINA_UNUSED, Efl_Core_Command_
|
||||||
return EINA_TRUE;
|
return EINA_TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
EOLIAN static void
|
||||||
|
_efl_core_command_line_efl_object_destructor(Eo *obj EINA_UNUSED, Efl_Core_Command_Line_Data *pd)
|
||||||
|
{
|
||||||
|
free(pd->string_command);
|
||||||
|
pd->string_command = NULL;
|
||||||
|
_clear_command(pd);
|
||||||
|
}
|
||||||
#include "efl_core_command_line.eo.c"
|
#include "efl_core_command_line.eo.c"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
mixin @beta Efl.Core.Command_Line {
|
mixin @beta Efl.Core.Command_Line requires Efl.Object {
|
||||||
[[A mixin that implements standard functions for command lines.
|
[[A mixin that implements standard functions for command lines.
|
||||||
|
|
||||||
This object parses the command line that gets passed, later the object can be accessed via accessor or the string
|
This object parses the command line that gets passed, later the object can be accessed via accessor or the string
|
||||||
|
@ -79,4 +79,7 @@ mixin @beta Efl.Core.Command_Line {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
implements {
|
||||||
|
Efl.Object.destructor;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue