From 5cd1a4674f6be638b17c84699842ab8d43c471b8 Mon Sep 17 00:00:00 2001 From: Alex Shvartzkop Date: Thu, 9 Nov 2023 20:52:37 +0300 Subject: [PATCH] Fix a crash in 3D viewer when changing preferences. It was possible for OnMouseMove to come after ReloadRequest but before DoRePaint. Which meant m_3d_render_raytracing->Reload() has't been called yet, thus the BVH contained invalid data. Fixes https://gitlab.com/kicad/code/kicad/-/issues/16059 --- 3d-viewer/3d_canvas/eda_3d_canvas.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/3d-viewer/3d_canvas/eda_3d_canvas.cpp b/3d-viewer/3d_canvas/eda_3d_canvas.cpp index c148abe901..4aab9ef18f 100644 --- a/3d-viewer/3d_canvas/eda_3d_canvas.cpp +++ b/3d-viewer/3d_canvas/eda_3d_canvas.cpp @@ -632,6 +632,9 @@ void EDA_3D_CANVAS::OnMagnify( wxMouseEvent& event ) void EDA_3D_CANVAS::OnMouseMove( wxMouseEvent& event ) { + if( m_3d_render && m_3d_render->IsReloadRequestPending() ) + return; // Prevents using invalid m_3d_render_raytracing data + if( m_camera_is_moving ) return;