Commit bd39af72 authored by Alon Levy's avatar Alon Levy

xspice: qxl_unmap_memory: stop worker and track worker status

stop the worker thread and track the status, ignoring io requests (i.e.
prevent red_dispatcher writes to red_worker) if red_worker is stopped.

This fixes spice red_worker asserts from actions attepted after X
has destroyed a screen. X runs in a loop destroying and recreating screens
multiple times during the process lifetime, whenever the last X client
has exited.

Note that the spice server is kept up during a X screen restart. This is
on purpose, to avoid a spice-client closing when doing a window manager
restart. Cleanup of the spice-server on atexit - still to do.
parent c4aff2b7
......@@ -191,6 +191,7 @@ struct _qxl_screen_t
struct QXLRom shadow_rom; /* Parameter RAM */
SpiceServer * spice_server;
QXLWorker * worker;
int worker_running;
QXLInstance display_sin;
/* XSpice specific, dragged from the Device */
QXLReleaseInfo *last_release;
......@@ -302,6 +302,12 @@ map_memory_helper(qxl_screen_t *qxl, int scrnIndex)
static void
qxl_unmap_memory(qxl_screen_t *qxl, int scrnIndex)
#ifdef XSPICE
if (qxl->worker) {
qxl->worker_running = FALSE;
unmap_memory_helper(qxl, scrnIndex);
qxl->ram = qxl->ram_physical = qxl->vram = qxl->rom = NULL;
......@@ -913,6 +919,7 @@ spiceqxl_screen_init(int scrnIndex, ScrnInfoPtr pScrn, qxl_screen_t *qxl)
spice_server_init(qxl->spice_server, core);
qxl->worker_running = TRUE;
qxl->spice_server = qxl->spice_server;
......@@ -171,6 +171,10 @@ void ioport_write(qxl_screen_t *qxl, uint32_t io_port, uint32_t val)
QXLRam *header = get_ram_header(qxl);
if (!qxl->worker_running) {
switch (io_port) {
Markdown is supported
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