summaryrefslogtreecommitdiff
path: root/platform/linuxbsd/display_server_x11.cpp
diff options
context:
space:
mode:
authorBastiaan Olij <mux213@gmail.com>2021-12-14 12:49:29 +1100
committerBastiaan Olij <mux213@gmail.com>2021-12-18 12:21:16 +1100
commitd08b28aeb0cc5c182a9094813ada6be2fc69e212 (patch)
tree6578ece6ee7cc4afdcfd98ca390a6d7a3295357f /platform/linuxbsd/display_server_x11.cpp
parentb0e93711b36bae3d2bb3a7e9a4a88faf055499fb (diff)
Fix initialising of gl_manager and checking gl_manager and context_vulkan preventing crash issues.
Diffstat (limited to 'platform/linuxbsd/display_server_x11.cpp')
-rw-r--r--platform/linuxbsd/display_server_x11.cpp24
1 files changed, 12 insertions, 12 deletions
diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp
index 74ec8b652f..247665e313 100644
--- a/platform/linuxbsd/display_server_x11.cpp
+++ b/platform/linuxbsd/display_server_x11.cpp
@@ -1150,7 +1150,7 @@ void DisplayServerX11::delete_sub_window(WindowID p_id) {
}
#ifdef VULKAN_ENABLED
- if (rendering_driver == "vulkan") {
+ if (context_vulkan) {
context_vulkan->window_destroy(p_id);
}
#endif
@@ -2927,7 +2927,7 @@ void DisplayServerX11::_window_changed(XEvent *event) {
wd.size = new_rect.size;
#if defined(VULKAN_ENABLED)
- if (rendering_driver == "vulkan") {
+ if (context_vulkan) {
context_vulkan->window_resize(window_id, wd.size.width, wd.size.height);
}
#endif
@@ -4672,12 +4672,12 @@ DisplayServerX11::~DisplayServerX11() {
//destroy all windows
for (KeyValue<WindowID, WindowData> &E : windows) {
#ifdef VULKAN_ENABLED
- if (rendering_driver == "vulkan") {
+ if (context_vulkan) {
context_vulkan->window_destroy(E.key);
}
#endif
#ifdef GLES3_ENABLED
- if (rendering_driver == "opengl3") {
+ if (gl_manager) {
gl_manager->window_destroy(E.key);
}
#endif
@@ -4693,15 +4693,15 @@ DisplayServerX11::~DisplayServerX11() {
//destroy drivers
#if defined(VULKAN_ENABLED)
- if (rendering_driver == "vulkan") {
- if (rendering_device_vulkan) {
- rendering_device_vulkan->finalize();
- memdelete(rendering_device_vulkan);
- }
+ if (rendering_device_vulkan) {
+ rendering_device_vulkan->finalize();
+ memdelete(rendering_device_vulkan);
+ rendering_device_vulkan = nullptr;
+ }
- if (context_vulkan) {
- memdelete(context_vulkan);
- }
+ if (context_vulkan) {
+ memdelete(context_vulkan);
+ context_vulkan = nullptr;
}
#endif