mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-02 15:50:13 +01:00
auth: destroy singleton instance of NMAuthManager on exit
This commit is contained in:
parent
eecc440351
commit
e5a82e5698
1 changed files with 6 additions and 16 deletions
|
|
@ -76,7 +76,8 @@ typedef struct {
|
|||
#endif
|
||||
} NMAuthManagerPrivate;
|
||||
|
||||
static NMAuthManager *singleton_instance = NULL;
|
||||
NM_DEFINE_SINGLETON_DESTRUCTOR (NMAuthManager);
|
||||
NM_DEFINE_SINGLETON_WEAK_REF (NMAuthManager);
|
||||
|
||||
G_DEFINE_TYPE (NMAuthManager, nm_auth_manager, G_TYPE_OBJECT)
|
||||
|
||||
|
|
@ -502,7 +503,10 @@ nm_auth_manager_setup (gboolean polkit_enabled)
|
|||
NULL);
|
||||
_LOGD ("set instance");
|
||||
|
||||
return (singleton_instance = self);
|
||||
singleton_instance = self;
|
||||
nm_singleton_instance_weak_ref_register ();
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
@ -609,19 +613,6 @@ dispose (GObject *object)
|
|||
G_OBJECT_CLASS (nm_auth_manager_parent_class)->dispose (object);
|
||||
}
|
||||
|
||||
static void
|
||||
finalize (GObject *object)
|
||||
{
|
||||
NMAuthManager* self = NM_AUTH_MANAGER (object);
|
||||
|
||||
G_OBJECT_CLASS (nm_auth_manager_parent_class)->finalize (object);
|
||||
|
||||
if (self == singleton_instance) {
|
||||
singleton_instance = NULL;
|
||||
_LOGD ("unset instance");
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
nm_auth_manager_class_init (NMAuthManagerClass *klass)
|
||||
{
|
||||
|
|
@ -633,7 +624,6 @@ nm_auth_manager_class_init (NMAuthManagerClass *klass)
|
|||
object_class->set_property = set_property;
|
||||
object_class->constructed = constructed;
|
||||
object_class->dispose = dispose;
|
||||
object_class->finalize = finalize;
|
||||
|
||||
g_object_class_install_property
|
||||
(object_class, PROP_POLKIT_ENABLED,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue