From e6742279cb1e5c09aebaa3a4389a419fd9189027 Mon Sep 17 00:00:00 2001 From: enricoturri1966 Date: Fri, 1 Jul 2022 12:47:23 +0200 Subject: [PATCH] Attempt to fix crash at startup on Mac OS --- src/slic3r/GUI/OpenGLManager.cpp | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/src/slic3r/GUI/OpenGLManager.cpp b/src/slic3r/GUI/OpenGLManager.cpp index 3de9dfb05..797e1df2e 100644 --- a/src/slic3r/GUI/OpenGLManager.cpp +++ b/src/slic3r/GUI/OpenGLManager.cpp @@ -467,12 +467,30 @@ wxGLContext* OpenGLManager::init_glcontext(wxGLCanvas& canvas) #if ENABLE_OPENGL_DEBUG_OPTION if (m_context == nullptr) { - wxGLContextAttrs attrs; - if (m_debug_enabled) - attrs.DebugCtx(); - attrs.EndList(); +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ // if no valid context was created use the default one - m_context = new wxGLContext(&canvas, nullptr, &attrs); + if (m_debug_enabled) { +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + std::cout << "OpenGLManager::init_glcontext(): create debug compatibility profile (" << required_opengl_version.first << "." << required_opengl_version.second << ")\n"; +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + wxGLContextAttrs attrs; + attrs.DebugCtx().EndList(); + m_context = new wxGLContext(&canvas, nullptr, &attrs); + } + else { +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + std::cout << "OpenGLManager::init_glcontext(): create compatibility profile (" << required_opengl_version.first << "." << required_opengl_version.second << ")\n"; +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ + m_context = new wxGLContext(&canvas); + } + +// wxGLContextAttrs attrs; +// if (m_debug_enabled) +// attrs.DebugCtx(); +// attrs.EndList(); +// // if no valid context was created use the default one +// m_context = new wxGLContext(&canvas, nullptr, &attrs); +//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ } #else if (m_context == nullptr)