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:
parent
26fa91a335
commit
f5a9bed34c
1 changed files with 6 additions and 0 deletions
|
@ -359,6 +359,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"
|
||||
|
@ -969,6 +970,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:
|
||||
|
@ -982,10 +984,14 @@ display_close(void *dptr)
|
|||
if (!initialized)
|
||||
return;
|
||||
|
||||
if (device != dptr)
|
||||
return;
|
||||
|
||||
free (points);
|
||||
ws_shutdown();
|
||||
|
||||
initialized = 0;
|
||||
device = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
|
|
Loading…
Add table
Reference in a new issue