Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/intern
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-07-01 08:33:18 +0300
committerCampbell Barton <campbell@blender.org>2022-07-01 08:33:51 +0300
commitb1d3b14711b2d113742b1693169a0997c737afcc (patch)
tree5c4cd551dc51d0084d48d6bbccac7e0ddffab822 /intern
parent650a15fb9b9cd32506454759a0c834d7535b8ee9 (diff)
Fix crash when creating an off-screen context fails in Wayland
This is very unlikely to happen but better not to crash.
Diffstat (limited to 'intern')
-rw-r--r--intern/ghost/intern/GHOST_SystemWayland.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp
index fb34a72235c..3a5e524782f 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -2789,14 +2789,18 @@ GHOST_IContext *GHOST_SystemWayland::createOffscreenContext(GHOST_GLSettings /*g
{
/* Create new off-screen window. */
wl_surface *wl_surface = wl_compositor_create_surface(compositor());
- wl_egl_window *egl_window = wl_egl_window_create(wl_surface, int(1), int(1));
+ wl_egl_window *egl_window = wl_surface ? wl_egl_window_create(wl_surface, 1, 1) : nullptr;
GHOST_Context *context = createOffscreenContext_impl(this, d->display, egl_window);
if (!context) {
GHOST_PRINT("Cannot create off-screen EGL context" << std::endl);
- wl_surface_destroy(wl_surface);
- wl_egl_window_destroy(egl_window);
+ if (wl_surface) {
+ wl_surface_destroy(wl_surface);
+ }
+ if (egl_window) {
+ wl_egl_window_destroy(egl_window);
+ }
return nullptr;
}