[glibmm] Glib::RefPtr: minor release() improvements.



commit d94115843f38967b5e883f5f7d8057882ae364cb
Author: Marcin Kolny <marcin kolny gmail com>
Date:   Fri Aug 7 10:25:50 2015 +0000

    Glib::RefPtr: minor release() improvements.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=752812
    
        * glib/glibmm/refptr.h: add warning in a comment, replace
          warn_unused_result attribute with corresponding GLib macro.

 glib/glibmm/refptr.h |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
---
diff --git a/glib/glibmm/refptr.h b/glib/glibmm/refptr.h
index 5e21384..30dbf18 100644
--- a/glib/glibmm/refptr.h
+++ b/glib/glibmm/refptr.h
@@ -20,6 +20,7 @@
  */
 
 #include <glibmmconfig.h>
+#include <glib.h>
 #include <utility>
 
 namespace Glib
@@ -146,8 +147,12 @@ public:
    *
    * RefPtr's underlying instance is set to nullptr, therefore underlying object can't be accessed through 
this RefPtr anymore.
    * @return an underlying instance.
+   *
+   * Most users should not use release(). It can spoil the automatic destruction
+   * of the managed object. A legitimate use is if you immediately give RefPtr's
+   * reference to another object.
    */
-  inline T_CppObject* release() __attribute__((warn_unused_result));
+  inline T_CppObject* release() G_GNUC_WARN_UNUSED_RESULT;
 
   /** Dynamic cast to derived class.
    *


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