/** * Stop the capture */ static void xshm_capture_stop(struct xshm_data *data) { obs_enter_graphics(); if (data->texture) { gs_texture_destroy(data->texture); data->texture = NULL; } if (data->cursor) { xcursor_destroy(data->cursor); data->cursor = NULL; } obs_leave_graphics(); if (data->xshm) { xshm_detach(data->xshm); data->xshm = NULL; } if (data->dpy) { XSync(data->dpy, true); XCloseDisplay(data->dpy); data->dpy = NULL; } if (data->server) { bfree(data->server); data->server = NULL; } }
XCompcapMain::~XCompcapMain() { ObsGsContextHolder obsctx; if (p->tex) { gs_texture_destroy(p->tex); p->tex = 0; } xcc_cleanup(p); if (p->cursor) { xcursor_destroy(p->cursor); p->cursor = nullptr; } delete p; }
/** * Destroy the capture */ static void xshm_destroy(void *vptr) { XSHM_DATA(vptr); if (!data) return; obs_enter_graphics(); if (data->texture) gs_texture_destroy(data->texture); if (data->cursor) xcursor_destroy(data->cursor); obs_leave_graphics(); if (data->xshm) xshm_detach(data->xshm); if (data->dpy) XCloseDisplay(data->dpy); bfree(data); }