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