summaryrefslogtreecommitdiffstats
path: root/agent
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2021-11-17 22:07:33 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2021-11-17 22:08:33 +0900
commit5a4577efe2428cdf7ef661260175d17e79f60913 (patch)
treefb29b8f32e7ddad68a61de99e9c55ab98120561f /agent
parent8b90718b72890f802409d24f61db8450fea7a861 (diff)
downloadpolkit-tqt-5a4577efe2428cdf7ef661260175d17e79f60913.tar.gz
polkit-tqt-5a4577efe2428cdf7ef661260175d17e79f60913.zip
Guarded g_object_ref/unref to avoid warning messages when the pointer is NULL.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it>
Diffstat (limited to 'agent')
-rw-r--r--agent/polkit-tqt-agent-session.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/agent/polkit-tqt-agent-session.cpp b/agent/polkit-tqt-agent-session.cpp
index b65bb90b2..eb8460be4 100644
--- a/agent/polkit-tqt-agent-session.cpp
+++ b/agent/polkit-tqt-agent-session.cpp
@@ -62,7 +62,10 @@ void Session::Private::completed(PolkitAgentSession *s, gboolean gained_authoriz
emit(session)->completed(gained_authorization);
//free session here as polkit documentation asks
- g_object_unref(session->d->polkitAgentSession);
+ if (session->d->polkitAgentSession)
+ {
+ g_object_unref(session->d->polkitAgentSession);
+ }
session->d->polkitAgentSession = 0;
}
@@ -171,7 +174,10 @@ void AsyncResult::setCompleted()
}
g_simple_async_result_complete(d->result);
// Assure that completed won't be called twice
- g_object_unref(d->result);
+ if (d->result)
+ {
+ g_object_unref(d->result);
+ }
d->result = NULL;
}