We need to call the element_free_func even if we remove the
last element. Bug #618866.
g_return_val_if_fail (index_ < array->len, NULL);
result = array->pdata[index_];
-
+
+ if (array->element_free_func != NULL)
+ array->element_free_func (array->pdata[index_]);
+
if (index_ != array->len - 1)
- {
- if (array->element_free_func != NULL)
- array->element_free_func (array->pdata[index_]);
- array->pdata[index_] = array->pdata[array->len - 1];
- }
+ array->pdata[index_] = array->pdata[array->len - 1];
array->len -= 1;