diff --git a/3d-viewer/3d_canvas/eda_3d_canvas.cpp b/3d-viewer/3d_canvas/eda_3d_canvas.cpp index c9e3cc40ee..8e6bab547b 100644 --- a/3d-viewer/3d_canvas/eda_3d_canvas.cpp +++ b/3d-viewer/3d_canvas/eda_3d_canvas.cpp @@ -383,6 +383,15 @@ void EDA_3D_CANVAS::DoRePaint() if( m_glRC == nullptr ) m_glRC = GL_CONTEXT_MANAGER::Get().CreateCtx( this ); + // CreateCtx could and does fail per sentry crash events, lets be graceful + if( m_glRC == nullptr ) + { + warningReporter.Report( _( "OpenGL context creation error" ), RPT_SEVERITY_ERROR ); + warningReporter.Finalize(); + m_is_currently_painting.clear(); + return; + } + GL_CONTEXT_MANAGER::Get().LockCtx( m_glRC, this ); // Set the OpenGL viewport according to the client size of this canvas. diff --git a/3d-viewer/3d_model_viewer/eda_3d_model_viewer.cpp b/3d-viewer/3d_model_viewer/eda_3d_model_viewer.cpp index d0f8c6a36f..29fa52ae2d 100644 --- a/3d-viewer/3d_model_viewer/eda_3d_model_viewer.cpp +++ b/3d-viewer/3d_model_viewer/eda_3d_model_viewer.cpp @@ -257,6 +257,13 @@ void EDA_3D_MODEL_VIEWER::OnPaint( wxPaintEvent& event ) if( m_glRC == nullptr ) m_glRC = GL_CONTEXT_MANAGER::Get().CreateCtx( this ); + // CreateCtx could and does fail per sentry crash events, lets be graceful + if( m_glRC == nullptr ) + { + wxLogTrace( m_logTrace, wxT( "EDA_3D_MODEL_VIEWER::OnPaint creating gl context failed" ) ); + return; + } + GL_CONTEXT_MANAGER::Get().LockCtx( m_glRC, this ); // Set the OpenGL viewport according to the client size of this canvas.