mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
gdbusdaemon: Add sanity checks on name refcounting
This should make the code a bit easier to reason about, and squash some static analysis warnings. Signed-off-by: Philip Withnall <withnall@endlessm.com> Helps: #1767
This commit is contained in:
parent
df647a583d
commit
d99653f6fe
@ -170,6 +170,7 @@ name_new (GDBusDaemon *daemon, const char *str)
|
||||
static Name *
|
||||
name_ref (Name *name)
|
||||
{
|
||||
g_assert (name->refcount > 0);
|
||||
name->refcount++;
|
||||
return name;
|
||||
}
|
||||
@ -177,6 +178,7 @@ name_ref (Name *name)
|
||||
static void
|
||||
name_unref (Name *name)
|
||||
{
|
||||
g_assert (name->refcount > 0);
|
||||
if (--name->refcount == 0)
|
||||
{
|
||||
g_hash_table_remove (name->daemon->names, name->name);
|
||||
|
Loading…
Reference in New Issue
Block a user