Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

libathemecore: if an object being unref'd is already being disposed, …

…just make the unref a noop
  • Loading branch information...
commit 03031b354307b0e362a6264c32ad380bf74d0885 1 parent d0b8c26
@kaniini kaniini authored
Showing with 9 additions and 4 deletions.
  1. +9 −4 libathemecore/object.c
View
13 libathemecore/object.c
@@ -151,11 +151,16 @@ void *object_sink_ref(void *obj)
void object_unref(void *obj)
{
return_if_fail(obj != NULL);
- return_if_fail(object(obj)->refcount > 0);
+ return_if_fail(object(obj)->refcount >= -1);
- object_sink_ref(obj);
- if (object(obj)->refcount == 0)
- object_dispose(obj);
+ if (object(obj)->refcount == -1)
+ return;
+ else if (object(obj)->refcount > 0)
+ {
+ object_sink_ref(obj);
+ if (object(obj)->refcount == 0)
+ object_dispose(obj);
+ }
}
/*
Please sign in to comment.
Something went wrong with that request. Please try again.