Don't free file entries while there are still images pending from them

SVN revision: 72826
This commit is contained in:
Iván Briano 2012-06-25 19:27:59 +00:00
parent 9a7ba8e27a
commit 0a1faf7af9
1 changed files with 9 additions and 8 deletions

View File

@ -596,7 +596,11 @@ _image_entry_free(Image_Data *entry)
} }
if (fentry) if (fentry)
fentry->images = eina_list_remove(fentry->images, entry); {
fentry->images = eina_list_remove(fentry->images, entry);
if (!fentry->images && !fentry->base.references)
eina_hash_del_by_key(file_entries, &fentry->base.id);
}
if (entry->shm) if (entry->shm)
cserve2_shm_unref(entry->shm); cserve2_shm_unref(entry->shm);
free(entry); free(entry);
@ -1069,13 +1073,10 @@ _entry_reference_del(Entry *entry, Reference *ref)
if (fentry->invalid) if (fentry->invalid)
_file_entry_free(fentry); _file_entry_free(fentry);
else else if (!fentry->images)
{ eina_hash_del_by_key(file_entries, &entry->id);
Image_Data *ie; /* don't free file entries that have images attached to it, they will
EINA_LIST_FREE(fentry->images, ie) * be freed when the last unused image is freed */
ie->file = NULL;
eina_hash_del_by_key(file_entries, &entry->id);
}
} }
else if (entry->type == CSERVE2_IMAGE_DATA) else if (entry->type == CSERVE2_IMAGE_DATA)
{ {