void dt_cleanup() { const int init_gui = (darktable.gui != NULL); #ifdef USE_LUA dt_lua_finalize(); #endif if(init_gui) { dt_ctl_switch_mode_to(DT_MODE_NONE); dt_dbus_destroy(darktable.dbus); dt_control_write_config(darktable.control); dt_control_shutdown(darktable.control); dt_lib_cleanup(darktable.lib); free(darktable.lib); } dt_view_manager_cleanup(darktable.view_manager); free(darktable.view_manager); if(init_gui) { dt_imageio_cleanup(darktable.imageio); free(darktable.imageio); dt_gui_gtk_cleanup(darktable.gui); free(darktable.gui); } dt_image_cache_cleanup(darktable.image_cache); free(darktable.image_cache); dt_mipmap_cache_cleanup(darktable.mipmap_cache); free(darktable.mipmap_cache); if(init_gui) { dt_control_cleanup(darktable.control); free(darktable.control); dt_undo_cleanup(darktable.undo); } dt_conf_cleanup(darktable.conf); free(darktable.conf); dt_points_cleanup(darktable.points); free(darktable.points); dt_iop_unload_modules_so(); dt_opencl_cleanup(darktable.opencl); free(darktable.opencl); #ifdef HAVE_GPHOTO2 dt_camctl_destroy(darktable.camctl); #endif dt_pwstorage_destroy(darktable.pwstorage); dt_fswatch_destroy(darktable.fswatch); #ifdef HAVE_GRAPHICSMAGICK DestroyMagick(); #endif dt_database_destroy(darktable.db); dt_bauhaus_cleanup(); dt_capabilities_cleanup(); dt_pthread_mutex_destroy(&(darktable.db_insert)); dt_pthread_mutex_destroy(&(darktable.plugin_threadsafe)); dt_pthread_mutex_destroy(&(darktable.capabilities_threadsafe)); dt_exif_cleanup(); #ifdef HAVE_GEGL gegl_exit(); #endif }
void dt_cleanup() { const int init_gui = (darktable.gui != NULL); #ifdef HAVE_PRINT dt_printers_abort_discovery(); #endif #ifdef USE_LUA dt_lua_finalize_early(); #endif if(init_gui) { dt_ctl_switch_mode_to(""); dt_dbus_destroy(darktable.dbus); dt_control_shutdown(darktable.control); dt_lib_cleanup(darktable.lib); free(darktable.lib); } #ifdef USE_LUA dt_lua_finalize(); #endif dt_view_manager_cleanup(darktable.view_manager); free(darktable.view_manager); if(init_gui) { dt_imageio_cleanup(darktable.imageio); free(darktable.imageio); free(darktable.gui); } dt_image_cache_cleanup(darktable.image_cache); free(darktable.image_cache); dt_mipmap_cache_cleanup(darktable.mipmap_cache); free(darktable.mipmap_cache); if(init_gui) { dt_control_cleanup(darktable.control); free(darktable.control); dt_undo_cleanup(darktable.undo); } dt_colorspaces_cleanup(darktable.color_profiles); dt_conf_cleanup(darktable.conf); free(darktable.conf); dt_points_cleanup(darktable.points); free(darktable.points); dt_iop_unload_modules_so(); dt_opencl_cleanup(darktable.opencl); free(darktable.opencl); #ifdef HAVE_GPHOTO2 dt_camctl_destroy((dt_camctl_t *)darktable.camctl); #endif dt_pwstorage_destroy(darktable.pwstorage); #ifdef HAVE_GRAPHICSMAGICK DestroyMagick(); #endif dt_guides_cleanup(darktable.guides); dt_database_destroy(darktable.db); if(init_gui) { dt_bauhaus_cleanup(); } dt_capabilities_cleanup(); dt_pthread_mutex_destroy(&(darktable.db_insert)); dt_pthread_mutex_destroy(&(darktable.plugin_threadsafe)); dt_pthread_mutex_destroy(&(darktable.capabilities_threadsafe)); dt_exif_cleanup(); }