From aac5a6cef72caa7cb26092db2923b70223005c6d Mon Sep 17 00:00:00 2001 From: Colin Walters <walters@verbum.org> Date: Mon, 25 Jan 2016 10:23:34 -0500 Subject: [PATCH] console: g_auto() macro no-ops if console is not locked Otherwise we miss a lot of the ergonomics of cleanup macros. --- glnx-console.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/glnx-console.h b/glnx-console.h index 9f620cc7c..8fc386567 100644 --- a/glnx-console.h +++ b/glnx-console.h @@ -45,7 +45,8 @@ guint glnx_console_columns (void); static inline void glnx_console_ref_cleanup (GLnxConsoleRef *p) { - glnx_console_unlock (p); + if (p->locked) + glnx_console_unlock (p); } G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC(GLnxConsoleRef, glnx_console_ref_cleanup) -- GitLab