Remove OSX 10.9.5 crash workaround (dead code with wxWidgets 3.3+)

wxWidgets 3.3 requires macOS 10.11+, making the 10.9.5-specific crash
workaround in OpenGLManager impossible to trigger. Remove:
- OSInfo struct and s_os_info static member from the header
- OS version recording in init_glcontext()
- Conditional wxGLContext deletion in the destructor (now always deletes)
- Unused #include <wx/platinfo.h>

The MacDarkMode.hpp include is retained as mac_max_scaling_factor() is
still used by GLInfo::get_max_tex_size().
This commit is contained in:
SoftFever
2026-03-24 20:39:45 +08:00
parent 8dcc3cd20d
commit 5be5185d17
2 changed files with 2 additions and 39 deletions

View File

@@ -19,9 +19,6 @@
#include "GUI_Init.hpp"
#ifdef __APPLE__
// Part of hack to remove crash when closing the application on OSX 10.9.5 when building against newer wxWidgets
#include <wx/platinfo.h>
#include "../Utils/MacDarkMode.hpp"
#endif // __APPLE__
@@ -237,26 +234,12 @@ bool OpenGLManager::s_force_power_of_two_textures = false;
OpenGLManager::EMultisampleState OpenGLManager::s_multisample = OpenGLManager::EMultisampleState::Unknown;
OpenGLManager::EFramebufferType OpenGLManager::s_framebuffers_type = OpenGLManager::EFramebufferType::Unknown;
#ifdef __APPLE__
// Part of hack to remove crash when closing the application on OSX 10.9.5 when building against newer wxWidgets
OpenGLManager::OSInfo OpenGLManager::s_os_info;
#endif // __APPLE__
OpenGLManager::~OpenGLManager()
{
m_shaders_manager.shutdown();
#ifdef __APPLE__
// This is an ugly hack needed to solve the crash happening when closing the application on OSX 10.9.5 with newer wxWidgets
// The crash is triggered inside wxGLContext destructor
if (s_os_info.major != 10 || s_os_info.minor != 9 || s_os_info.micro != 5)
{
#endif //__APPLE__
if (m_context != nullptr)
delete m_context;
#ifdef __APPLE__
}
#endif //__APPLE__
if (m_context != nullptr)
delete m_context;
}
bool OpenGLManager::init_gl(bool popup_error)
@@ -412,12 +395,6 @@ wxGLContext* OpenGLManager::init_glcontext(wxGLCanvas& canvas, const std::pair<i
m_context = new wxGLContext(&canvas, nullptr, &attrs);
}
#ifdef __APPLE__
// Part of hack to remove crash when closing the application on OSX 10.9.5 when building against newer wxWidgets
s_os_info.major = wxPlatformInfo::Get().GetOSMajorVersion();
s_os_info.minor = wxPlatformInfo::Get().GetOSMinorVersion();
s_os_info.micro = wxPlatformInfo::Get().GetOSMicroVersion();
#endif //__APPLE__
}
return m_context;
}

View File

@@ -62,16 +62,6 @@ public:
void detect() const;
};
#ifdef __APPLE__
// Part of hack to remove crash when closing the application on OSX 10.9.5 when building against newer wxWidgets
struct OSInfo
{
int major{ 0 };
int minor{ 0 };
int micro{ 0 };
};
#endif //__APPLE__
private:
enum class EMultisampleState : unsigned char
{
@@ -84,10 +74,6 @@ private:
wxGLContext* m_context{ nullptr };
GLShadersManager m_shaders_manager;
static GLInfo s_gl_info;
#ifdef __APPLE__
// Part of hack to remove crash when closing the application on OSX 10.9.5 when building against newer wxWidgets
static OSInfo s_os_info;
#endif //__APPLE__
static bool s_compressed_textures_supported;
static bool s_force_power_of_two_textures;