void _cairo_font_reset_static_data (void) { _cairo_scaled_font_map_destroy (); CAIRO_MUTEX_LOCK (cairo_toy_font_face_hash_table_mutex); _cairo_hash_table_destroy (cairo_toy_font_face_hash_table); cairo_toy_font_face_hash_table = NULL; CAIRO_MUTEX_UNLOCK (cairo_toy_font_face_hash_table_mutex); }
void _cairo_font_reset_static_data (void) { _cairo_scaled_font_map_destroy (); /* We manually acquire the lock rather than calling * cairo_toy_font_face_hash_table_lock simply to avoid * creating the table only to destroy it again. */ CAIRO_MUTEX_LOCK (_cairo_font_face_mutex); _cairo_hash_table_destroy (cairo_toy_font_face_hash_table); cairo_toy_font_face_hash_table = NULL; CAIRO_MUTEX_UNLOCK (_cairo_font_face_mutex); }
void _cairo_font_reset_static_data (void) { _cairo_scaled_font_map_destroy (); _cairo_lock_global_image_glyph_cache(); _cairo_cache_destroy (_global_image_glyph_cache); _global_image_glyph_cache = NULL; _cairo_unlock_global_image_glyph_cache(); CAIRO_MUTEX_LOCK (cairo_toy_font_face_hash_table_mutex); _cairo_hash_table_destroy (cairo_toy_font_face_hash_table); cairo_toy_font_face_hash_table = NULL; CAIRO_MUTEX_UNLOCK (cairo_toy_font_face_hash_table_mutex); }
/** * cairo_debug_reset_static_data: * * Resets all static data within cairo to its original state, * (ie. identical to the state at the time of program invocation). For * example, all caches within cairo will be flushed empty. * * This function is intended to be useful when using memory-checking * tools such as valgrind. When valgrind's memcheck analyzes a * cairo-using program without a call to cairo_debug_reset_static_data(), * it will report all data reachable via cairo's static objects as * "still reachable". Calling cairo_debug_reset_static_data() just prior * to program termination will make it easier to get squeaky clean * reports from valgrind. * * WARNING: It is only safe to call this function when there are no * active cairo objects remaining, (ie. the appropriate destroy * functions have been called as necessary). If there are active cairo * objects, this call is likely to cause a crash, (eg. an assertion * failure due to a hash table being destroyed when non-empty). **/ void cairo_debug_reset_static_data (void) { CAIRO_MUTEX_INITIALIZE (); _cairo_scaled_font_map_destroy (); _cairo_toy_font_face_reset_static_data (); #if CAIRO_HAS_FT_FONT _cairo_ft_font_reset_static_data (); #endif _cairo_intern_string_reset_static_data (); _cairo_scaled_font_reset_static_data (); _cairo_pattern_reset_static_data (); CAIRO_MUTEX_FINALIZE (); }
/** * cairo_debug_reset_static_data: * * Resets all static data within cairo to its original state, * (ie. identical to the state at the time of program invocation). For * example, all caches within cairo will be flushed empty. * * This function is intended to be useful when using memory-checking * tools such as valgrind. When valgrind's memcheck analyzes a * cairo-using program without a call to cairo_debug_reset_static_data(), * it will report all data reachable via cairo's static objects as * "still reachable". Calling cairo_debug_reset_static_data() just prior * to program termination will make it easier to get squeaky clean * reports from valgrind. * * WARNING: It is only safe to call this function when there are no * active cairo objects remaining, (ie. the appropriate destroy * functions have been called as necessary). If there are active cairo * objects, this call is likely to cause a crash, (eg. an assertion * failure due to a hash table being destroyed when non-empty). * * Since: 1.0 **/ void cairo_debug_reset_static_data (void) { CAIRO_MUTEX_INITIALIZE (); _cairo_scaled_font_map_destroy (); _cairo_toy_font_face_reset_static_data (); #if CAIRO_HAS_FT_FONT _cairo_ft_font_reset_static_data (); #endif #if CAIRO_HAS_WIN32_FONT _cairo_win32_font_reset_static_data (); #endif _cairo_intern_string_reset_static_data (); _cairo_scaled_font_reset_static_data (); _cairo_pattern_reset_static_data (); _cairo_clip_reset_static_data (); _cairo_image_reset_static_data (); #if CAIRO_HAS_DRM_SURFACE _cairo_drm_device_reset_static_data (); #endif _cairo_default_context_reset_static_data (); #if CAIRO_HAS_COGL_SURFACE _cairo_cogl_context_reset_static_data (); #endif CAIRO_MUTEX_FINALIZE (); }