void _cogl_destroy_context () { if (_context == NULL) return; _cogl_destroy_texture_units (); _cogl_free_framebuffer_stack (_context->framebuffer_stack); if (_context->path_nodes) g_array_free (_context->path_nodes, TRUE); if (_context->default_gl_texture_2d_tex) cogl_handle_unref (_context->default_gl_texture_2d_tex); if (_context->default_gl_texture_rect_tex) cogl_handle_unref (_context->default_gl_texture_rect_tex); if (_context->simple_material) cogl_handle_unref (_context->simple_material); if (_context->journal) g_array_free (_context->journal, TRUE); if (_context->logged_vertices) g_array_free (_context->logged_vertices, TRUE); if (_context->current_layers) g_array_free (_context->current_layers, TRUE); if (_context->quad_indices_byte) cogl_handle_unref (_context->quad_indices_byte); if (_context->quad_indices_short) cogl_handle_unref (_context->quad_indices_short); if (_context->default_material) cogl_handle_unref (_context->default_material); if (_context->atlas) _cogl_atlas_free (_context->atlas); if (_context->atlas_texture) cogl_handle_unref (_context->atlas_texture); g_free (_context); }
static void _cogl_context_free (CoglContext *context) { const CoglWinsysVtable *winsys = _cogl_context_get_winsys (context); winsys->context_deinit (context); _cogl_free_framebuffer_stack (context->framebuffer_stack); if (context->current_path) cogl_handle_unref (context->current_path); if (context->default_gl_texture_2d_tex) cogl_object_unref (context->default_gl_texture_2d_tex); if (context->default_gl_texture_3d_tex) cogl_object_unref (context->default_gl_texture_3d_tex); if (context->default_gl_texture_rect_tex) cogl_object_unref (context->default_gl_texture_rect_tex); if (context->opaque_color_pipeline) cogl_object_unref (context->opaque_color_pipeline); if (context->blended_color_pipeline) cogl_object_unref (context->blended_color_pipeline); if (context->texture_pipeline) cogl_object_unref (context->texture_pipeline); if (context->blit_texture_pipeline) cogl_object_unref (context->blit_texture_pipeline); if (context->swap_callback_closures) g_hash_table_destroy (context->swap_callback_closures); g_warn_if_fail (context->gles2_context_stack.length == 0); if (context->journal_flush_attributes_array) g_array_free (context->journal_flush_attributes_array, TRUE); if (context->journal_clip_bounds) g_array_free (context->journal_clip_bounds, TRUE); if (context->polygon_vertices) g_array_free (context->polygon_vertices, TRUE); if (context->quad_buffer_indices_byte) cogl_object_unref (context->quad_buffer_indices_byte); if (context->quad_buffer_indices) cogl_object_unref (context->quad_buffer_indices); if (context->rectangle_byte_indices) cogl_object_unref (context->rectangle_byte_indices); if (context->rectangle_short_indices) cogl_object_unref (context->rectangle_short_indices); if (context->default_pipeline) cogl_object_unref (context->default_pipeline); if (context->dummy_layer_dependant) cogl_object_unref (context->dummy_layer_dependant); if (context->default_layer_n) cogl_object_unref (context->default_layer_n); if (context->default_layer_0) cogl_object_unref (context->default_layer_0); if (context->current_clip_stack_valid) _cogl_clip_stack_unref (context->current_clip_stack); g_slist_free (context->atlases); g_hook_list_clear (&context->atlas_reorganize_callbacks); _cogl_bitmask_destroy (&context->enabled_builtin_attributes); _cogl_bitmask_destroy (&context->enable_builtin_attributes_tmp); _cogl_bitmask_destroy (&context->enabled_texcoord_attributes); _cogl_bitmask_destroy (&context->enable_texcoord_attributes_tmp); _cogl_bitmask_destroy (&context->enabled_custom_attributes); _cogl_bitmask_destroy (&context->enable_custom_attributes_tmp); _cogl_bitmask_destroy (&context->changed_bits_tmp); if (context->current_modelview_entry) cogl_matrix_entry_unref (context->current_modelview_entry); if (context->current_projection_entry) cogl_matrix_entry_unref (context->current_projection_entry); _cogl_matrix_entry_cache_destroy (&context->builtin_flushed_projection); _cogl_matrix_entry_cache_destroy (&context->builtin_flushed_modelview); _cogl_pipeline_cache_free (context->pipeline_cache); _cogl_sampler_cache_free (context->sampler_cache); _cogl_destroy_texture_units (); g_ptr_array_free (context->uniform_names, TRUE); g_hash_table_destroy (context->uniform_name_hash); g_hash_table_destroy (context->attribute_name_states_hash); g_array_free (context->attribute_name_index_map, TRUE); g_byte_array_free (context->buffer_map_fallback_array, TRUE); cogl_object_unref (context->display); g_free (context); }