static void lxynth_shutdown_driver (void) { DEBUGF ("%s (%s:%d)\n", __FUNCTION__, __FILE__, __LINE__); if (lxynth_root->running) { lxynth_root->running = 0; s_window_quit(lxynth_root->window); s_thread_join(lxynth_root->tid, NULL); kill_timer(lxynth_root->timerid); } while (!s_list_eol(lxynth_root->eventq->list, 0)) { s_event_t *event = s_list_get(lxynth_root->eventq->list, 0); s_list_remove(lxynth_root->eventq->list, 0); s_event_uninit(event); } s_free(lxynth_root->eventq->list); s_thread_mutex_destroy(lxynth_root->eventq->mut); s_free(lxynth_root->eventq); while (!s_list_eol(lxynth_root->gd->list, 0)) { struct graphics_device *gd = s_list_get(lxynth_root->gd->list, 0); lxynth_device_t *wd = (lxynth_device_t *) gd->driver_data; s_list_remove(lxynth_root->gd->list, 0); s_free(wd->title); s_surface_destroy(wd->surface); s_free(wd); s_free(gd); } s_free(lxynth_root->gd->list); s_thread_mutex_destroy(lxynth_root->gd->mut); s_free(lxynth_root->gd); s_free(lxynth_root); }
void s_window_uninit (s_window_t *window) { if (window == NULL) { return; } window->event->type = EVENT_TYPE_QUIT; s_event_changed(window); s_thread_join(window->eventq->tid, NULL); s_childs_uninit(window); if (window->type & (WINDOW_TYPE_TEMP | WINDOW_TYPE_CHILD)) { if (s_child_del(window->parent, window) == 0) { s_thread_detach(window->tid); } } else if (window->type & WINDOW_TYPE_POPUP) { s_thread_detach(window->tid); } debugf(DCLI, "[%d] Exiting (%s%s)", window->id, (window->type & WINDOW_TYPE_MAIN) ? "WINDOW_TYPE_MAIN" : ((window->type & WINDOW_TYPE_CHILD) ? "WINDOW_TYPE_CHILD" : ((window->type & WINDOW_TYPE_TEMP) ? "WINDOW_TYPE_TEMP" : ((window->type & WINDOW_TYPE_POPUP) ? "WINDOW_TYPE_POPUP" : ((window->type & WINDOW_TYPE_DESKTOP) ? "WINDOW_TYPE_DESKTOP" : "WINDOW_UNKNOWN")))), (window->type & WINDOW_TYPE_NOFORM) ? " | WINDOW_TYPE_NOFORM" : ""); /* andrei * call atexit only after we have released all children * the idea is to let the children access their parent's data attribute */ if (window->atexit != NULL) { window->atexit(window); } s_timers_uninit(window); s_pollfds_uninit(window); s_handlers_uninit(window); s_eventq_uninit(window); s_surface_uninit(window); s_event_uninit(window->event); s_free(window->title); s_free(window); window = NULL; }
void s_window_uninit (s_window_t *window) { if (window == NULL) { return; } window->event->type = QUIT_EVENT; s_event_changed(window); s_thread_join(window->eventq->tid, NULL); s_timers_uninit(window); s_pollfds_uninit(window); s_handlers_uninit(window); if (window->atexit != NULL) { window->atexit(window); } s_childs_uninit(window); if (window->type & (WINDOW_TEMP | WINDOW_CHILD)) { if (s_child_del(window->parent, window) == 0) { s_free(window->tid); } } debugf(DCLI, "[%d] Exiting (%s%s)", window->id, (window->type & WINDOW_MAIN) ? "WINDOW_MAIN" : ((window->type & WINDOW_CHILD) ? "WINDOW_CHILD" : ((window->type & WINDOW_TEMP) ? "WINDOW_TEMP" : ((window->type & WINDOW_DESKTOP) ? "WINDOW_DESKTOP" : "WINDOW_UNKNOWN"))), (window->type & WINDOW_NOFORM) ? " | WINDOW_NOFORM" : ""); s_eventq_uninit(window); s_surface_uninit(window); s_event_uninit(window->event); s_gettext_uninit(window); s_free(window->title); s_free(window); window = NULL; }
void s_video_sdl_server_uninit (void) { SDL_Event event; s_video_sdl_data_t *priv; if (xynth_server->driver->driver_data == NULL) { return; } priv = xynth_server->driver->driver_data; #if defined(CONFIG_SINGLE_APPLICATION) s_free((void *) xynth_server->window->surface->linear_mem_base); #else shmdt((void *) xynth_server->window->surface->linear_mem_base); #endif priv->screen->pixels = (char *) s_malloc(1); event.type = SDL_QUIT; SDL_PushEvent(&event); s_thread_join(priv->event_tid, NULL); if(SDL_WasInit(SDL_INIT_VIDEO)) { SDL_QuitSubSystem(SDL_INIT_VIDEO); } SDL_Quit(); s_free(priv); xynth_server->driver->driver_data = NULL; }