1
commit d3c337da01f3887da031fdb5c2ac784fb3e79210
2
Author: Nick Shaforostoff <shafff@ukr.net>
3
Date: Mon Dec 12 01:03:35 2011 +0200
7
use stricter refing in all places of 'identity' keeping.
8
it is interesting that it would be much harder
9
to accidentaly make same mistake if G API was C++ style and not C.
11
i also moved cleanup of successful sessions in time from system shutdown
12
to session completion as polkit docs say it should be
14
Index: polkit-qt-1-0.99.0/agent/polkitqt1-agent-session.cpp
15
===================================================================
16
--- polkit-qt-1-0.99.0.orig/agent/polkitqt1-agent-session.cpp 2011-12-14 08:24:19.476208706 -0500
17
+++ polkit-qt-1-0.99.0/agent/polkitqt1-agent-session.cpp 2011-12-14 08:24:59.664207519 -0500
20
Session::Private::~Private()
22
- g_object_unref(polkitAgentSession);
23
+ // polkitAgentSession is freed in Session d'tor
26
Session::Session(const PolkitQt1::Identity &identity, const QString &cookie, AsyncResult *result, QObject *parent)
31
+ if (d->polkitAgentSession)
32
+ g_object_unref(d->polkitAgentSession);
39
qDebug() << "COMPLETED";
40
Session *session = (Session *)user_data;
41
- Q_EMIT((Session *)user_data)->completed(gained_authorization);
42
+ Q_EMIT(session)->completed(gained_authorization);
44
+ //free session here as polkit documentation asks
45
+ g_object_unref(session->d->polkitAgentSession);
46
+ session->d->polkitAgentSession = 0;
49
void Session::Private::request(PolkitAgentSession *s, gchar *request, gboolean echo_on, gpointer user_data)
52
AsyncResult::~AsyncResult()
54
- g_object_unref(d->result);
56
+ g_object_unref(d->result);
59
void AsyncResult::setCompleted()
60
Index: polkit-qt-1-0.99.0/core/polkitqt1-identity.cpp
61
===================================================================
62
--- polkit-qt-1-0.99.0.orig/core/polkitqt1-identity.cpp 2011-12-14 08:24:44.952207954 -0500
63
+++ polkit-qt-1-0.99.0/core/polkitqt1-identity.cpp 2011-12-14 08:24:59.664207519 -0500
66
, identity(other.identity)
68
- g_object_ref(identity);
70
+ g_object_ref(identity);
74
- g_object_unref(identity);
76
+ g_object_unref(identity);
79
PolkitIdentity *identity;
83
d->identity = polkitIdentity;
85
+ g_object_ref(d->identity);
88
Identity::Identity(const PolkitQt1::Identity& other)
91
void Identity::setIdentity(PolkitIdentity *identity)
93
+ if (d->identity == identity)
97
+ g_object_unref(d->identity);
98
d->identity = identity;
100
+ g_object_ref(d->identity);
103
QString Identity::toString() const