static void ufo_resources_finalize (GObject *object) { UfoResourcesPrivate *priv; priv = UFO_RESOURCES_GET_PRIVATE (object); g_clear_error (&priv->construct_error); g_hash_table_destroy (priv->kernel_cache); list_free_full (&priv->kernel_paths, (GFunc) g_free); list_free_full (&priv->include_paths, (GFunc) g_free); list_free_full (&priv->kernels, (GFunc) release_kernel); list_free_full (&priv->programs, (GFunc) release_program); for (guint i = 0; i < priv->n_devices; i++) UFO_RESOURCES_CHECK_CLERR (clReleaseCommandQueue (priv->command_queues[i])); if (priv->context) UFO_RESOURCES_CHECK_CLERR (clReleaseContext (priv->context)); g_string_free (priv->build_opts, TRUE); g_free (priv->devices); g_free (priv->command_queues); priv->kernels = NULL; priv->devices = NULL; G_OBJECT_CLASS (ufo_resources_parent_class)->finalize (object); g_debug ("UfoResources: finalized"); }
/** * Destroys this module freeing any allocated data. */ void event_destroy() { List *link; EventInfo *event; // Iterate through all events link = list_first(l_events); while (link) { event = (EventInfo *)link->data; // Clear the entire list of handlers, freeing the data too. list_free_full(event->l_event_handlers, free); link = list_next(link); } // Clear the entire list of events, freeing the data too. list_free_full(l_events, free); }
/** * Destroys this module freeing any allocated data. */ void timer_destroy() { List *link; TimerInfo *timer; // Unregister events event_disconnect(evt_sdl_user); // Iterate through all timers link = list_first(l_timers); while (link) { timer = (TimerInfo *)link->data; // Disable all timers _timer_set_state(timer, TIMER_DISABLED); link = list_next(link); } // Release resources list_free_full(l_timers, free); }