#include #include #include #include #include int main() { printf("Start\n"); printf("Press any key to continue\n"); getc(stdin); DBusError error; DBusConnection *conn; int *refcount; // refcount is the first int in DBusConnection dbus_error_init(&error); char * n = "unix:abstract=/tmp/dbus-qU6CcYr5ke"; // current address of the session bus on ubuntu for(int i = 0; i < 10000; i++) { printf("Trial %d\n", i); conn = dbus_connection_open(n, &error); //conn = dbus_bus_get(DBUS_BUS_SESSION , &error); if(conn == NULL) { printf("Error dbus_connection_open %s %s\n", error.name, error.message); break; } refcount = (int*)(conn); printf("conn ptr %p refcount %d\n", (void*)conn, *refcount); /*if(dbus_bus_register(conn, &error) == 0) { printf("Error dbus_bus_register: %s %s\n", error.name, error.message); break; }*/ //dbus_connection_unref(conn); } printf("End\n"); printf("Press any key to exit\n"); getc(stdin); return 0; }