if (ws->gen >= DRV_R600) {
radeon_surface_manager_free(ws->surf_man);
}
+
+ if (ws->fd)
+ close(ws->fd);
+
FREE(rws);
}
return NULL;
}
- ws->fd = fd;
+ ws->fd = dup(fd);
if (!do_winsys_init(ws))
goto fail;
goto fail;
if (ws->gen >= DRV_R600) {
- ws->surf_man = radeon_surface_manager_new(fd);
+ ws->surf_man = radeon_surface_manager_new(ws->fd);
if (!ws->surf_man)
goto fail;
}
return NULL;
}
- util_hash_table_set(fd_tab, intptr_to_pointer(fd), ws);
+ util_hash_table_set(fd_tab, intptr_to_pointer(ws->fd), ws);
/* We must unlock the mutex once the winsys is fully initialized, so that
* other threads attempting to create the winsys from the same fd will
ws->kman->destroy(ws->kman);
if (ws->surf_man)
radeon_surface_manager_free(ws->surf_man);
+ if (ws->fd)
+ close(ws->fd);
+
FREE(ws);
return NULL;
}