Merge branch 'master' into blender2.8
[blender.git] / source / blender / windowmanager / intern / wm_init_exit.c
index 7608b015f49053215b72d37d3d70bf4b8659a2f0..fc1805e102f0a7acac2e0529de8ddac7cd9fafcb 100644 (file)
 #include "GPU_draw.h"
 #include "GPU_init_exit.h"
 
-#include "BKE_depsgraph.h"
 #include "BKE_sound.h"
 #include "COM_compositor.h"
 
+#include "DEG_depsgraph.h"
+
 #ifdef WITH_OPENSUBDIV
 #  include "BKE_subsurf.h"
 #endif
@@ -164,17 +165,21 @@ void WM_init(bContext *C, int argc, const char **argv)
        wm_operatortype_init();
        WM_menutype_init();
        WM_uilisttype_init();
+       wm_manipulatortype_init();
+       wm_manipulatorgrouptype_init();
 
        BKE_undo_callback_wm_kill_jobs_set(wm_undo_kill_callback);
 
        BKE_library_callback_free_window_manager_set(wm_close_and_free);   /* library.c */
        BKE_library_callback_free_notifier_reference_set(WM_main_remove_notifier_reference);   /* library.c */
+       BKE_region_callback_free_manipulatormap_set(wm_manipulatormap_remove); /* screen.c */
+       BKE_region_callback_refresh_tag_manipulatormap_set(WM_manipulatormap_tag_refresh);
        BKE_library_callback_remap_editor_id_reference_set(WM_main_remap_editor_id_reference);   /* library.c */
        BKE_blender_callback_test_break_set(wm_window_testbreak); /* blender.c */
        BKE_spacedata_callback_id_remap_set(ED_spacedata_id_remap); /* screen.c */
-       DAG_editors_update_cb(ED_render_id_flush_update,
-                             ED_render_scene_update,
-                             ED_render_scene_update_pre); /* depsgraph.c */
+       DEG_editors_set_update_cb(ED_render_id_flush_update,
+                                 ED_render_scene_update,
+                                 ED_render_scene_update_pre);
        
        ED_spacetypes_init();   /* editors/space_api/spacetype.c */
        
@@ -473,7 +478,7 @@ void WM_exit_ext(bContext *C, const bool do_python)
                        CTX_wm_window_set(C, win);  /* needed by operator close callbacks */
                        WM_event_remove_handlers(C, &win->handlers);
                        WM_event_remove_handlers(C, &win->modalhandlers);
-                       ED_screen_exit(C, win, win->screen);
+                       ED_screen_exit(C, win, WM_window_get_active_screen(win));
                }
        }
 
@@ -524,6 +529,11 @@ void WM_exit_ext(bContext *C, const bool do_python)
        ED_gpencil_strokes_copybuf_free();
        BKE_node_clipboard_clear();
 
+       /* free manipulator-maps after freeing blender, so no deleted data get accessed during cleaning up of areas */
+       wm_manipulatormaptypes_free();
+       wm_manipulatorgrouptype_free();
+       wm_manipulatortype_free();
+
        BLF_exit();
 
 #ifdef WITH_INTERNATIONAL