Blender Git Commit Log

Git Commits -> Revision f8354d4

Revision f8354d4 by Sybren A. Stüvel (master)
November 15, 2019, 14:13 (GMT)
Fix crash when freeing Blender after GTests

This only frees brush_rng and random_tex_array when they were actually
previously allocated.

In a unit test (see D6246) I want to be able to partially start Blender
so that I can load a blend file. To prevent memory leaks, I also want to
be able to release memory, which currently requires calling
`BKE_blender_free()`. This unconditionally calls `RE_texture_rng_exit()`
and `BKE_brush_system_exit()`, which now crash on freeing `NULL`. This
patch fixes that.

Allocation (`BKE_brush_system_init()`) and freeing
(`BKE_brush_system_exit()`) are done asymmetrically. The allocation
functions are called from `main()` in the creator module, but the
freeing is done by `BKE_blender_free()` the Window Manager. Ideally we
symmetrise this and initialise Blender from outside the window manager
(so that the initialisation can be done without WM and Python too), but
for now I'm happy when things don't crash.

Reviewed by: sergey via pair programming

Commit Details:

Full Hash: f8354d492d4ab3a7514cf5bfb28452f83cb662c1
Parent Commit: b6973ed
Lines Changed: +8, -0

2 Modified Paths:

/source/blender/blenkernel/intern/brush.c (+4, -0) (Diff)
/source/blender/render/intern/source/render_texture.c (+4, -0) (Diff)
By: Miika HämäläinenLast update: Nov-07-2014 14:18MiikaHweb | 2003-2021