Commit b409c9c4 authored by Steve Lhomme's avatar Steve Lhomme
Browse files

frame: handle cancelation when memory mapping on Win32

The function is a cancelation point, so we should handle it from all code
pathes.
parent 2db583da
Pipeline #306415 passed with stage
in 18 minutes and 32 seconds
......@@ -385,6 +385,14 @@ vlc_frame_t *vlc_frame_shm_Alloc (void *addr, size_t length)
#endif
#ifdef _WIN32
static void cleanup_hmap(void *opaque)
{
HANDLE hMap = opaque;
CloseHandle(hMap);
}
#endif
vlc_frame_t *vlc_frame_File(int fd, bool write)
{
size_t length;
......@@ -455,6 +463,9 @@ vlc_frame_t *vlc_frame_File(int fd, bool write)
if (hMap != INVALID_HANDLE_VALUE)
addr = MapViewOfFile(hMap, access, 0, 0, length);
#endif
vlc_cleanup_push(cleanup_hmap, hMap);
vlc_testcancel();
vlc_cleanup_pop();
if (addr != NULL)
return vlc_frame_mapview_Alloc(hMap, addr, length);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment