eet - fix seg when doing unusual things with eet write then read
if you write and read0-back before writign out (non-sensical to do as you would write out in full and close and then open file and read separately) the dictionary will be empty. fill it in these paths. fixes needed resulting from optimizations in 1.26.0 @fix
This commit is contained in:
parent
29029bc781
commit
34a36b49e1
|
@ -289,6 +289,8 @@ int
|
|||
eet_dictionary_string_get_hash(Eet_Dictionary *ed,
|
||||
int index);
|
||||
|
||||
void
|
||||
eet_dictionary_write_prepare_unlocked(Eet_Dictionary *ed);
|
||||
void
|
||||
eet_dictionary_write_prepare(Eet_Dictionary *ed);
|
||||
|
||||
|
|
|
@ -3481,6 +3481,8 @@ _eet_data_descriptor_decode(Eet_Free_Context *context,
|
|||
Eet_Data_Chunk chnk;
|
||||
Eina_Bool need_free = EINA_FALSE;
|
||||
|
||||
if (ed) eet_dictionary_write_prepare_unlocked((Eet_Dictionary *)ed);
|
||||
|
||||
if (_eet_data_words_bigendian == -1)
|
||||
{
|
||||
unsigned long int v;
|
||||
|
@ -3732,6 +3734,8 @@ eet_data_get_list(Eet_Free_Context *context,
|
|||
list = *ptr;
|
||||
data_ret = NULL;
|
||||
|
||||
if (ed) eet_dictionary_write_prepare_unlocked((Eet_Dictionary *)ed);
|
||||
|
||||
if (IS_POINTER_TYPE(type))
|
||||
POINTER_TYPE_DECODE(context,
|
||||
ed,
|
||||
|
@ -3797,6 +3801,8 @@ eet_data_get_hash(Eet_Free_Context *context,
|
|||
ptr = (void **)data;
|
||||
hash = *ptr;
|
||||
|
||||
if (ed) eet_dictionary_write_prepare_unlocked((Eet_Dictionary *)ed);
|
||||
|
||||
/* Read key */
|
||||
ret = eet_data_get_type(ed,
|
||||
EET_T_STRING,
|
||||
|
@ -3899,6 +3905,8 @@ eet_data_get_array(Eet_Free_Context *context,
|
|||
|
||||
EET_ASSERT(!((type > EET_T_UNKNOW) && (type < EET_T_STRING)), return 0);
|
||||
|
||||
if (ed) eet_dictionary_write_prepare_unlocked((Eet_Dictionary *)ed);
|
||||
|
||||
ptr = data;
|
||||
/* read the number of elements */
|
||||
ret = eet_data_get_type(ed,
|
||||
|
@ -4117,6 +4125,8 @@ eet_data_get_union(Eet_Free_Context *context,
|
|||
int ret = 0;
|
||||
int i;
|
||||
|
||||
if (ed) eet_dictionary_write_prepare_unlocked((Eet_Dictionary *)ed);
|
||||
|
||||
/* Read type */
|
||||
ret = eet_data_get_type(ed,
|
||||
EET_T_STRING,
|
||||
|
@ -4344,6 +4354,8 @@ eet_data_get_variant(Eet_Free_Context *context,
|
|||
int ret = 0;
|
||||
int i;
|
||||
|
||||
if (ed) eet_dictionary_write_prepare_unlocked((Eet_Dictionary *)ed);
|
||||
|
||||
/* Read type */
|
||||
ret = eet_data_get_type(ed,
|
||||
EET_T_STRING,
|
||||
|
@ -4532,6 +4544,8 @@ eet_data_get_unknown(Eet_Free_Context *context,
|
|||
int ret;
|
||||
void *data_ret;
|
||||
|
||||
if (ed) eet_dictionary_write_prepare_unlocked((Eet_Dictionary *)ed);
|
||||
|
||||
if (IS_SIMPLE_TYPE(type))
|
||||
{
|
||||
unsigned long long dd[128];
|
||||
|
@ -4830,6 +4844,8 @@ eet_data_dump_cipher(Eet_File *ef,
|
|||
|
||||
ed = eet_dictionary_get(ef);
|
||||
|
||||
if (ed) eet_dictionary_write_prepare((Eet_Dictionary *)ed);
|
||||
|
||||
if (!cipher_key)
|
||||
data = eet_read_direct(ef, name, &size);
|
||||
|
||||
|
|
|
@ -95,14 +95,9 @@ on_error:
|
|||
}
|
||||
|
||||
void
|
||||
eet_dictionary_write_prepare(Eet_Dictionary *ed)
|
||||
eet_dictionary_write_prepare_unlocked(Eet_Dictionary *ed)
|
||||
{
|
||||
eina_rwlock_take_write(&ed->rwlock);
|
||||
if (!ed->add_hash)
|
||||
{
|
||||
eina_rwlock_release(&ed->rwlock);
|
||||
return;
|
||||
}
|
||||
if (!ed->add_hash) return;
|
||||
|
||||
ed->total = ed->count;
|
||||
|
||||
|
@ -113,6 +108,13 @@ eet_dictionary_write_prepare(Eet_Dictionary *ed)
|
|||
eina_hash_foreach(ed->add_hash, _eet_dictionary_write_prepare_hash_cb, ed);
|
||||
eina_hash_free(ed->add_hash);
|
||||
ed->add_hash = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
eet_dictionary_write_prepare(Eet_Dictionary *ed)
|
||||
{
|
||||
eina_rwlock_take_write(&ed->rwlock);
|
||||
eet_dictionary_write_prepare_unlocked(ed);
|
||||
eina_rwlock_release(&ed->rwlock);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue