summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Walters <walters@verbum.org>2016-01-25 10:23:34 -0500
committerColin Walters <walters@verbum.org>2016-01-25 10:23:34 -0500
commitaac5a6cef72caa7cb26092db2923b70223005c6d (patch)
treeb467c06f30927e5ca843c92ff3283a04f6528170
parent2ca280f0124eddcac8aa868fdbeb679bb6e57139 (diff)
downloadlibglnx-aac5a6cef72caa7cb26092db2923b70223005c6d.tar.gz
console: g_auto() macro no-ops if console is not locked
Otherwise we miss a lot of the ergonomics of cleanup macros.
-rw-r--r--glnx-console.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/glnx-console.h b/glnx-console.h
index 9f620cc..8fc3865 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)