One part of doing C++ the right way is using automatic variables for everything you possibly can. However at some point in your C++ endeavours, you’re likely to be using a C API of some sort, with explicit method calls to manage lifecycles, which can make this more difficult. My work at Canonical has involved talking to lots of these sorts of APIs, many of them based on GNOME’s Glib. To make life easier, I have created a set of easy to use wrappers to manage the lifecycle Glib and GObject objects.
DBus is the most common RPC middleware used in Linux desktop shell development. Unfortunately it does not provide much support for testing services using it. I created libqtdbustest and libqtdbusmock to fill this gap, for Qt/C++ based services, at least.