You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ORBit2/ORBit2-2.14.3-ref-leaks.patch

52 lines
1.4 KiB

--- ORBit2-2.14.3/src/orb/orb-core/orbit-object.c.ref-leaks 2003-10-29 07:22:12.000000000 -0500
+++ ORBit2-2.14.3/src/orb/orb-core/orbit-object.c 2006-12-08 12:03:55.000000000 -0500
@@ -115,16 +115,22 @@
obj->refs = 0;
}
+#define ORBIT_REFCOUNT_IMMORTAL (ORBIT_REFCOUNT_MAX / 2)
+
gpointer
ORBit_RootObject_duplicate (gpointer obj)
{
ORBit_RootObject robj = obj;
- if (robj && robj->refs != ORBIT_REFCOUNT_STATIC) {
+ if (robj && robj->refs != ORBIT_REFCOUNT_STATIC &&
+ robj->refs != ORBIT_REFCOUNT_IMMORTAL) {
LINK_MUTEX_LOCK (ORBit_RootObject_lifecycle_lock);
robj->refs++;
total_refs++;
LINK_MUTEX_UNLOCK (ORBit_RootObject_lifecycle_lock);
+ if (robj->refs == ORBIT_REFCOUNT_IMMORTAL)
+ g_warning ("ORB: ORBit_RootObject %p became immortal"
+ " - reference leaks present", robj);
}
return obj;
@@ -135,9 +141,13 @@
{
ORBit_RootObject robj = obj;
- if (robj && robj->refs != ORBIT_REFCOUNT_STATIC) {
+ if (robj && robj->refs != ORBIT_REFCOUNT_STATIC &&
+ robj->refs != ORBIT_REFCOUNT_IMMORTAL) {
robj->refs++;
total_refs++;
+ if (robj->refs == ORBIT_REFCOUNT_IMMORTAL)
+ g_warning ("ORB: ORBit_RootObject %p became immortal"
+ " - reference leaks present", robj);
}
return obj;
@@ -148,6 +158,9 @@
{
g_assert (robj->refs < ORBIT_REFCOUNT_MAX && robj->refs > 0);
+ if (robj->refs == ORBIT_REFCOUNT_IMMORTAL)
+ return;
+
robj->refs--;
total_refs--;