chiark / gitweb /
bus: break reference cycle between bus and messages
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 31 Dec 2013 04:13:38 +0000 (23:13 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 3 Jan 2014 00:45:47 +0000 (19:45 -0500)
commit6ee4f99042a289d0afecc11d322f0addd483c093
treeaf84bf842f0c10fe13370ca8d8bdd10f1796ac5a
parentccd06097c79218f7d5ea4c21721bbcbc7c467dca
bus: break reference cycle between bus and messages

Because messages in the read and write queues hold a reference on the
bus, and the bus holds a reference on each of them, we would never
free the bus if the read or write queues were not empty. Explicitly
substract the number of messages in those queue from the bus reference
count when deciding whether to free or not.

A simple test which creates and unrefs simple objects is added.
src/libsystemd-bus/test-bus-cleanup.c [new file with mode: 0644]