Summary:
This was causing problems on non-Linux architectures as eina_file_real_close unmapped not mapped data. Added a "copied" flag to Eina_File which is set on eina_file_virtualize (on copied data), and tested for when eina_file_real_close does the unmap. I'm surprised Linux allowed this. Certainly all of the BSDs crashed with the previous behaviour.
@fix T5479
Test Plan: Example inlcude Rage and Enlightenment Thumb on BSD systems which use eina_file_virtualize with emotion to obtain album artwork.
Reviewers: raster, cedric, jpeg
Reviewed By: jpeg
Maniphest Tasks: T5479
Differential Revision: https://phab.enlightenment.org/D5006
free(map);
}
- if (file->global_map != MAP_FAILED)
+ if (!file->copied && file->global_map != MAP_FAILED)
munmap(file->global_map, file->length);
if (file->fd != -1) close(file->fd);
if (copy)
{
+ file->copied = EINA_TRUE;
file->global_map = ((char *)file) + head_padded;
memcpy((char *)file->global_map, data, length);
}
Eina_Bool delete_me : 1; /**< Indicates that this file should be deleted */
Eina_Bool global_faulty : 1; /**< Indicates whether #global_map is bad */
Eina_Bool virtual : 1; /**< Indicates that this is a virtual file */
+ Eina_Bool copied : 1; /**< Indicates whether this file has copied data */
};
/**