Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:12.3
polkit-qt-1
d3c337da.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File d3c337da.patch of Package polkit-qt-1
commit d3c337da01f3887da031fdb5c2ac784fb3e79210 Author: Nick Shaforostoff <shafff@ukr.net> Date: Mon Dec 12 01:03:35 2011 +0200 BUG: 258916 use stricter refing in all places of 'identity' keeping. it is interesting that it would be much harder to accidentaly make same mistake if G API was C++ style and not C. i also moved cleanup of successful sessions in time from system shutdown to session completion as polkit docs say it should be diff --git a/agent/polkitqt1-agent-session.cpp b/agent/polkitqt1-agent-session.cpp index 20cd403..52ddacf 100644 --- a/agent/polkitqt1-agent-session.cpp +++ b/agent/polkitqt1-agent-session.cpp @@ -46,7 +46,7 @@ public: Session::Private::~Private() { - g_object_unref(polkitAgentSession); + // polkitAgentSession is freed in Session d'tor } Session::Session(const PolkitQt1::Identity &identity, const QString &cookie, AsyncResult *result, QObject *parent) @@ -74,6 +74,9 @@ Session::Session(PolkitAgentSession *pkAgentSession, QObject *parent) Session::~Session() { + if (d->polkitAgentSession) + g_object_unref(d->polkitAgentSession); + delete d; } @@ -101,7 +104,11 @@ void Session::Private::completed(PolkitAgentSession *s, gboolean gained_authoriz { qDebug() << "COMPLETED"; Session *session = (Session *)user_data; - Q_EMIT((Session *)user_data)->completed(gained_authorization); + Q_EMIT(session)->completed(gained_authorization); + + //free session here as polkit documentation asks + g_object_unref(session->d->polkitAgentSession); + session->d->polkitAgentSession = 0; } void Session::Private::request(PolkitAgentSession *s, gchar *request, gboolean echo_on, gpointer user_data) @@ -139,7 +146,8 @@ AsyncResult::AsyncResult(GSimpleAsyncResult *result) AsyncResult::~AsyncResult() { - g_object_unref(d->result); + if (d->result) + g_object_unref(d->result); } void AsyncResult::setCompleted() diff --git a/core/polkitqt1-identity.cpp b/core/polkitqt1-identity.cpp index abf5abb..9cef558 100644 --- a/core/polkitqt1-identity.cpp +++ b/core/polkitqt1-identity.cpp @@ -35,11 +35,13 @@ public: : QSharedData(other) , identity(other.identity) { - g_object_ref(identity); + if (identity) + g_object_ref(identity); } ~Data() { - g_object_unref(identity); + if (identity) + g_object_unref(identity); } PolkitIdentity *identity; @@ -56,6 +58,8 @@ Identity::Identity(PolkitIdentity *polkitIdentity) { g_type_init(); d->identity = polkitIdentity; + if (d->identity) + g_object_ref(d->identity); } Identity::Identity(const PolkitQt1::Identity& other) @@ -86,7 +90,14 @@ PolkitIdentity *Identity::identity() const void Identity::setIdentity(PolkitIdentity *identity) { + if (d->identity == identity) + return; + + if (d->identity) + g_object_unref(d->identity); d->identity = identity; + if (d->identity) + g_object_ref(d->identity); } QString Identity::toString() const
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor