renderer-native: Don't crash if the FB surface can't be locked
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Tue, 8 May 2018 21:36:33 +0000 (22:36 +0100)
committerSimon McVittie <smcv@debian.org>
Sun, 8 Jul 2018 10:32:56 +0000 (11:32 +0100)
(cherry picked from commit 0332b7394e56f71c15692663ab05f8c84a4b9eff)

Origin: upstream, 3.28.3, commit:a41d84db00b3105dc630d91707c0f5dd888394ec

Gbp-Pq: Name renderer-native-Don-t-crash-if-the-FB-surface-can-t-be-lo.patch

src/backends/native/meta-renderer-native.c

index 2571cac25e39aa9fc5c1641bed517d14a0d15280..cb8e03abe2076407da1635d2f5b1e4d21145cd9f 100644 (file)
@@ -1601,6 +1601,12 @@ gbm_get_next_fb_id (MetaGpuKms         *gpu_kms,
   /* Now we need to set the CRTC to whatever is the front buffer */
   next_bo = gbm_surface_lock_front_buffer (gbm_surface);
 
+  if (!next_bo)
+    {
+      g_error ("Impossible to lock surface front buffer: %m");
+      return FALSE;
+    }
+
   for (i = 0; i < gbm_bo_get_plane_count (next_bo); i++)
     {
       strides[i] = gbm_bo_get_stride_for_plane (next_bo, i);