From d94115843f38967b5e883f5f7d8057882ae364cb Mon Sep 17 00:00:00 2001 From: Marcin Kolny Date: Fri, 7 Aug 2015 10:25:50 +0000 Subject: 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 file changed, 6 insertions(+), 1 deletion(-) diff --git a/glib/glibmm/refptr.h b/glib/glibmm/refptr.h index 5e213849..30dbf185 100644 --- a/glib/glibmm/refptr.h +++ b/glib/glibmm/refptr.h @@ -20,6 +20,7 @@ */ #include +#include #include 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. * -- cgit v1.2.1