diff --git a/display/display.c b/display/display.c index 22efa6e3..b3c5cd13 100644 --- a/display/display.c +++ b/display/display.c @@ -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