Commit graph

4 commits

Author SHA1 Message Date
Georges Basile Stavracas Neto
7f5b5d6060 object-cache: Declare singleton instance as static
Otherwise, it is visible for other compile units. This
is a theoretical problem though, there's nothing wrong
happening right now.
2018-09-25 20:45:12 -03:00
Andrea Azzarone
d7857c113a object-storage: Check for cancellation before resulting in assert failure
As per doumentation: "It is a programming error to create an identical proxy
while asynchronously creating one. Not cancelling this operation will result in
an assertion failure when calling cc_object_storage_create_dbus_proxy_finish()."
In order to fullfill the second part we need to check for errors (including
cancellation ones) before we generate an assertion failure.

Fixes: https://gitlab.gnome.org/GNOME/gnome-control-center/issues/158
2018-09-25 17:12:18 +02:00
Andrea Azzarone
6ec0bcde15 object-storage: Avoid double free when propagating error
In cc_object_storage_create_dbus_proxy_sync and
cc_object_storage_create_dbus_proxy_finish we need to use g_steal_pointer to
make sure local_error is not double freed.

Fixes: https://gitlab.gnome.org/GNOME/gnome-control-center/issues/86
2018-05-10 00:56:19 +02:00
Georges Basile Stavracas Neto
083e7bdae6 object-storage: Introduce CcObjectStorage
CcObjectStorage is a cache for GObjects. It is meant to
store objects that are too expensive to be often created,
such as NMClient, GoaClient or D-Bus proxies.

CcObjectStorage has a very strict usage pattern. It is a
programming error to add an object that is already stored,
and so it is to retrieve an object that was not stored.
Stored objects are meant to be kept alive during the whole
lifetime of GNOME Settings, and CcObjectStorage takes a
reference on every stored object to achieve that.

If objects are destroyed while they are cached, it means
we have a reference mismanagement somewhere. In this sense,
CcObjectStorage will act Sam Sheepdog taking care of sneaky
wolves trying to steal their sheep-references.

Next patches will make various panels and objects around
GNOME Settings adopt this new API, and make sure they always
disconnect when destroyed.
2018-04-06 22:23:38 -03:00