static void ShutDown(XEngine *xeng) { p_scr *s = xeng->s; p_win *w = xeng->w; p_win *win = xeng->win; if ((Engine *)xeng == gxCurrentEngine) gxCurrentEngine = NULL; xeng->mapped= 0; /* turn off all event callbacks (probably unnecessary) */ xeng->e.on = 0; /* destroy any hlevel references without further ado */ if (HLevelHook) HLevelHook((Engine *)xeng); xeng->w = xeng->win = 0; xeng->s = 0; /* note that p_destroy and GpDelEngine call on_destroy in Windows */ if (w && w!=win) p_destroy(w); GpDelEngine(&xeng->e); if (s) { if (!p_wincount(s)) g_pending_task = g_do_disconnect; } }
static void ShutDown(XEngine *xeng) { p_scr *s = xeng->s; p_win *w = xeng->w; p_win *win = xeng->win; xeng->mapped= 0; /* destroy any hlevel references without further ado */ if (HLevelHook) HLevelHook((Engine *)xeng); xeng->w = xeng->win = 0; xeng->s = 0; if (w && w!=win) p_destroy(w); GpDelEngine(&xeng->e); if (s) { Engine *eng; XEngine *xe2; for (eng=GpNextEngine(0) ; eng ; eng=GpNextEngine(eng)) { xe2 = GisXEngine(eng); if (xe2 && xe2->s==s) break; } if (!eng) { int i; if (g_pending_task == g_do_disconnect) { for (i=0 ; i<=G_N_PENDING ; i++) if (g_pending_scr[i] == s) break; if (i >= G_N_PENDING) { for (i=0 ; i<=G_N_PENDING ; i++) if (!g_pending_scr[i]) break; if (i < G_N_PENDING) g_pending_scr[i] = s; } } else { g_pending_scr[0] = s; for (i=1 ; i<=G_N_PENDING ; i++) g_pending_scr[i] = 0; g_pending_task = g_do_disconnect; } } } }