mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-09 12:25:48 +01:00
gobject: Make g_clear_object take a non-volatile GObject **
The implementation is silently discarding this anyway, and g_object_unref() is using atomic operations. So this should be safe. Having this here triggers -Wdiscarded-qualifiers when g_clear_pointer() is fixed to use __typeof__().
This commit is contained in:
parent
449dcca106
commit
2aacef39b1
@ -3378,7 +3378,7 @@ g_object_unref (gpointer _object)
|
|||||||
**/
|
**/
|
||||||
#undef g_clear_object
|
#undef g_clear_object
|
||||||
void
|
void
|
||||||
g_clear_object (volatile GObject **object_ptr)
|
g_clear_object (GObject **object_ptr)
|
||||||
{
|
{
|
||||||
g_clear_pointer (object_ptr, g_object_unref);
|
g_clear_pointer (object_ptr, g_object_unref);
|
||||||
}
|
}
|
||||||
|
@ -668,7 +668,7 @@ G_STMT_START { \
|
|||||||
G_OBJECT_WARN_INVALID_PSPEC ((object), "property", (property_id), (pspec))
|
G_OBJECT_WARN_INVALID_PSPEC ((object), "property", (property_id), (pspec))
|
||||||
|
|
||||||
GLIB_AVAILABLE_IN_ALL
|
GLIB_AVAILABLE_IN_ALL
|
||||||
void g_clear_object (volatile GObject **object_ptr);
|
void g_clear_object (GObject **object_ptr);
|
||||||
#define g_clear_object(object_ptr) g_clear_pointer ((object_ptr), g_object_unref)
|
#define g_clear_object(object_ptr) g_clear_pointer ((object_ptr), g_object_unref)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -132,7 +132,7 @@ test_clear (void)
|
|||||||
static void
|
static void
|
||||||
test_clear_function (void)
|
test_clear_function (void)
|
||||||
{
|
{
|
||||||
volatile GObject *o = NULL;
|
GObject *o = NULL;
|
||||||
GObject *tmp;
|
GObject *tmp;
|
||||||
|
|
||||||
(g_clear_object) (&o);
|
(g_clear_object) (&o);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user