diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-08-10 00:04:58 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-08-10 00:05:07 +0300 |
commit | a9a7460570958c0741f4222497805db45d6db5bc (patch) | |
tree | 7be590a1325d29c849d839fbe677dd9fb58c6fea /source/blender | |
parent | 11bdc321a274712e5c5ae83ff2c199690f66ecf7 (diff) |
DRW: DebugDraw: Fix unguarded drw_debug_draw()
This might create nullptr dereference in some cases.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/draw/intern/draw_debug.cc | 4 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_manager.c | 1 |
2 files changed, 4 insertions, 1 deletions
diff --git a/source/blender/draw/intern/draw_debug.cc b/source/blender/draw/intern/draw_debug.cc index 4bfdda06609..c610d7a2ffc 100644 --- a/source/blender/draw/intern/draw_debug.cc +++ b/source/blender/draw/intern/draw_debug.cc @@ -595,11 +595,13 @@ blender::draw::DebugDraw *DRW_debug_get() void drw_debug_draw() { - if (!GPU_shader_storage_buffer_objects_support()) { +#ifdef DEBUG + if (!GPU_shader_storage_buffer_objects_support() || DST.debug == nullptr) { return; } /* TODO(fclem): Convenience for now. Will have to move to DRWManager. */ reinterpret_cast<blender::draw::DebugDraw *>(DST.debug)->display_to_view(); +#endif } /** diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c index 4688ca6604e..63c7cc667cb 100644 --- a/source/blender/draw/intern/draw_manager.c +++ b/source/blender/draw/intern/draw_manager.c @@ -3029,6 +3029,7 @@ void DRW_engines_free(void) DRW_globals_free(); drw_debug_module_free(DST.debug); + DST.debug = NULL; DRW_UBO_FREE_SAFE(G_draw.block_ubo); DRW_UBO_FREE_SAFE(G_draw.view_ubo); |