Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-09-09 15:38:55 +0300
committerCampbell Barton <campbell@blender.org>2022-09-09 15:43:34 +0300
commit8f8ae06b515c0fe479ba8b3cfb27c354c031e483 (patch)
treeeb102c19ecf46de82eec057dd4b76476228c3711
parentf4e5a8654487ef8b66cf5fb2ca3f4d66cb207618 (diff)
Fix use-after-free error when exiting on WIN32
The logging API was freed before calling wm_autosave_delete that called BKE_appdir_folder_id_create to get the auto-save location (when the temporary directory wasn't found). Detecting BLENDER_USER_AUTOSAVE would log details about the path, which would read data freed by CLG_exit. Resolve by calling CLG_exit last.
-rw-r--r--source/blender/windowmanager/intern/wm_init_exit.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/source/blender/windowmanager/intern/wm_init_exit.c b/source/blender/windowmanager/intern/wm_init_exit.c
index 8163b39b3dd..283b87f1a2f 100644
--- a/source/blender/windowmanager/intern/wm_init_exit.c
+++ b/source/blender/windowmanager/intern/wm_init_exit.c
@@ -634,13 +634,15 @@ void WM_exit_ex(bContext *C, const bool do_python)
BKE_sound_exit();
BKE_appdir_exit();
- CLG_exit();
BKE_blender_atexit();
wm_autosave_delete();
BKE_tempdir_session_purge();
+
+ /* Keep last (or near last) so logging can be used right up until everything is shut-down. */
+ CLG_exit();
}
void WM_exit(bContext *C)