[mutter] renderer/native: META_DRM_BUFFER is not NULL-safe



commit 94992ffff6ab7080f28a74b5b918ec0416dc9396
Author: Pekka Paalanen <pekka paalanen collabora com>
Date:   Mon Sep 16 15:24:52 2019 +0300

    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

 src/backends/native/meta-renderer-native.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
---
diff --git a/src/backends/native/meta-renderer-native.c b/src/backends/native/meta-renderer-native.c
index d5ba66ad0..7f7eab5e0 100644
--- a/src/backends/native/meta-renderer-native.c
+++ b/src/backends/native/meta-renderer-native.c
@@ -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:


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]