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
path: root/source
diff options
context:
space:
mode:
authorSybren A. Stüvel <sybren@blender.org>2019-07-10 13:32:10 +0300
committerSybren A. Stüvel <sybren@blender.org>2019-07-10 13:32:10 +0300
commit12ceea04344ac8267d391b57187ffd0aa336c3cb (patch)
tree11740dd5c765b9c998cd1d1b0175f57148a4dac1 /source
parentf9232c080d1f0ac5da6b9ab6a5f28aac0d91469f (diff)
Fix crash when clicking in window while Blender starts
A mouse click in the window will trigger the `VIEW3D_OT_cursor3d` operator before the viewport is available. This causes a segfault in `GPU_viewport_engines_data_validate()`. Other callers of `WM_draw_region_get_viewport()` already check for `NULL` being returned and handle it gracefully. Reviewed By: jbakker, fclem Differential Revision: https://developer.blender.org/D5216
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/space_view3d/view3d_draw.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c
index 2e34ff7f9c1..eef36dae86a 100644
--- a/source/blender/editors/space_view3d/view3d_draw.c
+++ b/source/blender/editors/space_view3d/view3d_draw.c
@@ -804,7 +804,11 @@ void ED_view3d_draw_depth(Depsgraph *depsgraph, ARegion *ar, View3D *v3d, bool a
GPU_depth_test(true);
GPUViewport *viewport = WM_draw_region_get_viewport(ar, 0);
- DRW_draw_depth_loop(depsgraph, ar, v3d, viewport);
+ /* When Blender is starting, a click event can trigger a depth test while the viewport is not
+ * yet available. */
+ if (viewport != NULL) {
+ DRW_draw_depth_loop(depsgraph, ar, v3d, viewport);
+ }
if (rv3d->rflag & RV3D_CLIPPING) {
ED_view3d_clipping_disable();