renderer/native: META_DRM_BUFFER is not NULL-safe

I could not find this in GObject documentation, but I hear the cast macro is
not safe to call with NULL.

https://gitlab.gnome.org/GNOME/mutter/merge_requests/810
This commit is contained in:
Pekka Paalanen 2019-09-16 15:24:52 +03:00 committed by Jonas Ådahl
parent d7c9042c78
commit 94992ffff6

View File

@ -1832,14 +1832,15 @@ copy_shared_framebuffer_gpu (CoglOnscreen *onscreen,
secondary_gpu_state->gbm.surface, secondary_gpu_state->gbm.surface,
renderer_native->use_modifiers, renderer_native->use_modifiers,
&error); &error);
secondary_gpu_state->gbm.next_fb = META_DRM_BUFFER (buffer_gbm); if (!buffer_gbm)
if (!secondary_gpu_state->gbm.next_fb)
{ {
g_warning ("meta_drm_buffer_gbm_new failed: %s", g_warning ("meta_drm_buffer_gbm_new failed: %s",
error->message); error->message);
g_error_free (error); g_error_free (error);
return; return;
} }
secondary_gpu_state->gbm.next_fb = META_DRM_BUFFER (buffer_gbm);
} }
static MetaDumbBuffer * static MetaDumbBuffer *
@ -2235,14 +2236,15 @@ meta_onscreen_native_swap_buffers_with_damage (CoglOnscreen *onscreen,
onscreen_native->gbm.surface, onscreen_native->gbm.surface,
renderer_native->use_modifiers, renderer_native->use_modifiers,
&error); &error);
onscreen_native->gbm.next_fb = META_DRM_BUFFER (buffer_gbm); if (!buffer_gbm)
if (!onscreen_native->gbm.next_fb)
{ {
g_warning ("meta_drm_buffer_gbm_new failed: %s", g_warning ("meta_drm_buffer_gbm_new failed: %s",
error->message); error->message);
return; return;
} }
onscreen_native->gbm.next_fb = META_DRM_BUFFER (buffer_gbm);
break; break;
#ifdef HAVE_EGL_DEVICE #ifdef HAVE_EGL_DEVICE
case META_RENDERER_NATIVE_MODE_EGL_DEVICE: case META_RENDERER_NATIVE_MODE_EGL_DEVICE: