summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbruvzg <7645683+bruvzg@users.noreply.github.com>2022-07-06 09:56:47 +0300
committerbruvzg <7645683+bruvzg@users.noreply.github.com>2022-07-06 09:56:47 +0300
commita194043ea81bcc1aa1d431834327ffa778d561bb (patch)
treec7ef88b1884c5896c92e6c57fc1eb4aa8224210a
parent83ad1231a7d3e4c8a7eda97229fa409df263d2e6 (diff)
Check if GL manager exist to prevent crash when using multithreaded renderer with Vulkan.
-rw-r--r--platform/linuxbsd/display_server_x11.cpp8
-rw-r--r--platform/osx/display_server_osx.mm4
-rw-r--r--platform/windows/display_server_windows.cpp4
3 files changed, 12 insertions, 4 deletions
diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp
index ee26abab86..b0f87484b9 100644
--- a/platform/linuxbsd/display_server_x11.cpp
+++ b/platform/linuxbsd/display_server_x11.cpp
@@ -4175,13 +4175,17 @@ void DisplayServerX11::process_events() {
void DisplayServerX11::release_rendering_thread() {
#if defined(GLES3_ENABLED)
- gl_manager->release_current();
+ if (gl_manager) {
+ gl_manager->release_current();
+ }
#endif
}
void DisplayServerX11::make_rendering_thread() {
#if defined(GLES3_ENABLED)
- gl_manager->make_current();
+ if (gl_manager) {
+ gl_manager->make_current();
+ }
#endif
}
diff --git a/platform/osx/display_server_osx.mm b/platform/osx/display_server_osx.mm
index b6a5813bd0..4307685422 100644
--- a/platform/osx/display_server_osx.mm
+++ b/platform/osx/display_server_osx.mm
@@ -2920,7 +2920,9 @@ void DisplayServerOSX::make_rendering_thread() {
void DisplayServerOSX::swap_buffers() {
#if defined(GLES3_ENABLED)
- gl_manager->swap_buffers();
+ if (gl_manager) {
+ gl_manager->swap_buffers();
+ }
#endif
}
diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp
index 03d0d0e0bd..e66fa142a7 100644
--- a/platform/windows/display_server_windows.cpp
+++ b/platform/windows/display_server_windows.cpp
@@ -656,7 +656,9 @@ void DisplayServerWindows::delete_sub_window(WindowID p_window) {
void DisplayServerWindows::gl_window_make_current(DisplayServer::WindowID p_window_id) {
#if defined(GLES3_ENABLED)
- gl_manager->window_make_current(p_window_id);
+ if (gl_manager) {
+ gl_manager->window_make_current(p_window_id);
+ }
#endif
}