[libglnx] console: g_auto() macro no-ops if console is not locked



commit aac5a6cef72caa7cb26092db2923b70223005c6d
Author: Colin Walters <walters verbum org>
Date:   Mon Jan 25 10:23:34 2016 -0500

    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 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)
 


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