summaryrefslogtreecommitdiffstats
path: root/core/polkit-tqt-authority.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'core/polkit-tqt-authority.cpp')
-rw-r--r--core/polkit-tqt-authority.cpp60
1 files changed, 48 insertions, 12 deletions
diff --git a/core/polkit-tqt-authority.cpp b/core/polkit-tqt-authority.cpp
index 3bdfe9bf9..d8e4aa297 100644
--- a/core/polkit-tqt-authority.cpp
+++ b/core/polkit-tqt-authority.cpp
@@ -67,7 +67,10 @@ ActionDescription::List actionsToListAndFree(GList *glist)
{
gpointer i = glist2->data;
result.append(ActionDescription(static_cast<PolkitActionDescription*>(i)));
- g_object_unref(i);
+ if (i)
+ {
+ g_object_unref(i);
+ }
}
g_list_free(glist);
return result;
@@ -121,14 +124,38 @@ class Authority::Private
Authority::Private::~Private()
{
- g_object_unref(m_checkAuthorizationCancellable);
- g_object_unref(m_enumerateActionsCancellable);
- g_object_unref(m_registerAuthenticationAgentCancellable);
- g_object_unref(m_unregisterAuthenticationAgentCancellable);
- g_object_unref(m_authenticationAgentResponseCancellable);
- g_object_unref(m_enumerateTemporaryAuthorizationsCancellable);
- g_object_unref(m_revokeTemporaryAuthorizationsCancellable);
- g_object_unref(m_revokeTemporaryAuthorizationCancellable);
+ if (m_checkAuthorizationCancellable)
+ {
+ g_object_unref(m_checkAuthorizationCancellable);
+ }
+ if (m_enumerateActionsCancellable)
+ {
+ g_object_unref(m_enumerateActionsCancellable);
+ }
+ if (m_registerAuthenticationAgentCancellable)
+ {
+ g_object_unref(m_registerAuthenticationAgentCancellable);
+ }
+ if (m_unregisterAuthenticationAgentCancellable)
+ {
+ g_object_unref(m_unregisterAuthenticationAgentCancellable);
+ }
+ if (m_authenticationAgentResponseCancellable)
+ {
+ g_object_unref(m_authenticationAgentResponseCancellable);
+ }
+ if (m_enumerateTemporaryAuthorizationsCancellable)
+ {
+ g_object_unref(m_enumerateTemporaryAuthorizationsCancellable);
+ }
+ if (m_revokeTemporaryAuthorizationsCancellable)
+ {
+ g_object_unref(m_revokeTemporaryAuthorizationsCancellable);
+ }
+ if (m_revokeTemporaryAuthorizationCancellable)
+ {
+ g_object_unref(m_revokeTemporaryAuthorizationCancellable);
+ }
}
void Authority::Private::init()
@@ -185,7 +212,10 @@ Authority::Authority(TQObject *parent) : TQObject(parent), d(new Private(this))
Authority::~Authority()
{
- g_object_unref(d->pkAuthority);
+ if (d->pkAuthority)
+ {
+ g_object_unref(d->pkAuthority);
+ }
delete d;
}
@@ -634,7 +664,10 @@ TemporaryAuthorization::List Authority::enumerateTemporaryAuthorizationsSync(con
for (glist2 = glist; glist2 != NULL; glist2 = g_list_next(glist2))
{
result.append(TemporaryAuthorization((PolkitTemporaryAuthorization*)glist2->data));
- g_object_unref(glist2->data);
+ if (glist2->data)
+ {
+ g_object_unref(glist2->data);
+ }
}
g_list_free(glist);
return result;
@@ -667,7 +700,10 @@ void Authority::Private::enumerateTemporaryAuthorizationsCallback(GObject *objec
for (glist2 = glist; glist2 != NULL; glist2 = g_list_next(glist2))
{
res.append(TemporaryAuthorization((PolkitTemporaryAuthorization*)glist2->data));
- g_object_unref(glist2->data);
+ if (glist2->data)
+ {
+ g_object_unref(glist2->data);
+ }
}
g_list_free(glist);
emit authority->enumerateTemporaryAuthorizationsFinished(res);