meta/egl-gbm: Use g_autofd to clean up BO FD automatically
Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/4027>
This commit is contained in:
parent
ca7345588f
commit
ada199621c
@ -24,6 +24,7 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
|
#include <glib/gstdio.h>
|
||||||
#include <drm_fourcc.h>
|
#include <drm_fourcc.h>
|
||||||
|
|
||||||
#include "backends/native/meta-egl-gbm.h"
|
#include "backends/native/meta-egl-gbm.h"
|
||||||
@ -42,7 +43,7 @@ create_gbm_bo_egl_image (MetaEgl *egl,
|
|||||||
struct gbm_bo *shared_bo,
|
struct gbm_bo *shared_bo,
|
||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
int shared_bo_fd;
|
g_autofd int shared_bo_fd = -1;
|
||||||
unsigned int width;
|
unsigned int width;
|
||||||
unsigned int height;
|
unsigned int height;
|
||||||
uint32_t i, n_planes;
|
uint32_t i, n_planes;
|
||||||
@ -98,7 +99,6 @@ create_gbm_bo_egl_image (MetaEgl *egl,
|
|||||||
offsets,
|
offsets,
|
||||||
use_modifiers ? modifiers : NULL,
|
use_modifiers ? modifiers : NULL,
|
||||||
error);
|
error);
|
||||||
close (shared_bo_fd);
|
|
||||||
|
|
||||||
return egl_image;
|
return egl_image;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user