From bff8388b1f1fcedde31289c0bd509c34fcde3376 Mon Sep 17 00:00:00 2001 From: Chengwei Yang Date: Fri, 23 Aug 2013 18:00:37 +0800 Subject: [PATCH v2 4/7] Make sure the debug output ref is correct There were some debug codes written when there is no _dbus_atomic_get() available, this patch fix these old codes with the new function to make sure we get the correct debug output. --- dbus/dbus-server.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/dbus/dbus-server.c b/dbus/dbus-server.c index efe7d1d..9835bac 100644 --- a/dbus/dbus-server.c +++ b/dbus/dbus-server.c @@ -463,8 +463,9 @@ _dbus_server_ref_unlocked (DBusServer *server) old_refcount = _dbus_atomic_inc (&server->refcount); _dbus_assert (old_refcount > 0); - _dbus_server_trace_ref (server, old_refcount, old_refcount + 1, - "ref_unlocked"); + _dbus_server_trace_ref (server, old_refcount, + _dbus_atomic_get (&server->refcount), + "ref_unlocked"); } /** @@ -486,8 +487,9 @@ _dbus_server_unref_unlocked (DBusServer *server) old_refcount = _dbus_atomic_dec (&server->refcount); _dbus_assert (old_refcount > 0); - _dbus_server_trace_ref (server, old_refcount, old_refcount - 1, - "unref_unlocked"); + _dbus_server_trace_ref (server, old_refcount, + _dbus_atomic_get (&server->refcount), + "unref_unlocked"); if (old_refcount == 1) { @@ -714,7 +716,9 @@ dbus_server_ref (DBusServer *server) } #endif - _dbus_server_trace_ref (server, old_refcount, old_refcount + 1, "ref"); + _dbus_server_trace_ref (server, old_refcount, + _dbus_atomic_get (&server->refcount), + "ref"); return server; } @@ -751,7 +755,9 @@ dbus_server_unref (DBusServer *server) } #endif - _dbus_server_trace_ref (server, old_refcount, old_refcount - 1, "unref"); + _dbus_server_trace_ref (server, old_refcount, + _dbus_atomic_get (&server->refcount), + "unref"); if (old_refcount == 1) { -- 1.7.9.5