1
0
mirror of https://github.com/rcornwell/sims.git synced 2026-04-03 20:32:34 +00:00

DISPLAY: Keep track of device using the display.

Don't let someone close the display if they're not the one having
opened it.
This commit is contained in:
Lars Brinkhoff
2020-02-24 20:58:18 +01:00
parent a33dd11018
commit 52b008dc01

View File

@@ -369,6 +369,7 @@ static long queue_interval;
#define Y(P) (((P) - points) / xpixels)
static int initialized = 0;
static void *device = NULL; /* Current display device. */
/*
* global set by O/S display level to indicate "light pen tip switch activated"
@@ -979,6 +980,7 @@ display_init(enum display_type type, int sf, void *dptr)
initialized = 1;
init_failed = 0; /* hey, we made it! */
device = dptr;
return 1;
failed:
@@ -992,10 +994,14 @@ display_close(void *dptr)
if (!initialized)
return;
if (device != dptr)
return;
free (points);
ws_shutdown();
initialized = 0;
device = NULL;
}
void