OBS-URL: https://build.opensuse.org/package/show/KDE:Frameworks5/polkit-qt5-1?expand=0&rev=1
97 lines
2.3 KiB
Diff
97 lines
2.3 KiB
Diff
From: Martin Briza <mbriza@redhat.com>
|
|
Date: Fri, 22 Mar 2013 14:52:52 +0000
|
|
Subject: Fixed reference counting of GObjects
|
|
X-Git-Url: http://quickgit.kde.org/?p=polkit-qt-1.git&a=commitdiff&h=4ed9c3fa043b70ee50176c4baacc07d1c73f1fce
|
|
---
|
|
Fixed reference counting of GObjects
|
|
|
|
Gets us rid of some crashes and reduces memory leaking. There's a change it fixes crashes~
|
|
|
|
BUGS: 257802, 286935, 291977, 307323
|
|
---
|
|
|
|
|
|
--- a/agent/polkitqt1-agent-listener.cpp
|
|
+++ b/agent/polkitqt1-agent-listener.cpp
|
|
@@ -62,6 +62,10 @@
|
|
g_type_init();
|
|
|
|
d->listener = listener;
|
|
+
|
|
+ if (d->listener != NULL) {
|
|
+ g_object_ref(d->listener);
|
|
+ }
|
|
}
|
|
|
|
Listener::~Listener()
|
|
|
|
--- a/agent/polkitqt1-agent-session.cpp
|
|
+++ b/agent/polkitqt1-agent-session.cpp
|
|
@@ -66,6 +66,9 @@
|
|
, d(new Private)
|
|
{
|
|
d->polkitAgentSession = pkAgentSession;
|
|
+ if (d->polkitAgentSession) {
|
|
+ g_object_ref(d->polkitAgentSession);
|
|
+ }
|
|
g_signal_connect(G_OBJECT(d->polkitAgentSession), "completed", G_CALLBACK(Private::completed), this);
|
|
g_signal_connect(G_OBJECT(d->polkitAgentSession), "request", G_CALLBACK(Private::request), this);
|
|
g_signal_connect(G_OBJECT(d->polkitAgentSession), "show-error", G_CALLBACK(Private::showError), this);
|
|
|
|
--- a/core/polkitqt1-details.cpp
|
|
+++ b/core/polkitqt1-details.cpp
|
|
@@ -35,11 +35,15 @@
|
|
: QSharedData(other)
|
|
, polkitDetails(other.polkitDetails)
|
|
{
|
|
- g_object_ref(polkitDetails);
|
|
+ if (polkitDetails != NULL) {
|
|
+ g_object_ref(polkitDetails);
|
|
+ }
|
|
}
|
|
~Data()
|
|
{
|
|
- g_object_unref(polkitDetails);
|
|
+ if (polkitDetails != NULL) {
|
|
+ g_object_unref(polkitDetails);
|
|
+ }
|
|
}
|
|
|
|
PolkitDetails *polkitDetails;
|
|
@@ -57,6 +61,10 @@
|
|
{
|
|
g_type_init();
|
|
d->polkitDetails = pkDetails;
|
|
+
|
|
+ if (d->polkitDetails != NULL) {
|
|
+ g_object_ref(d->polkitDetails);
|
|
+ }
|
|
}
|
|
|
|
Details::~Details()
|
|
|
|
--- a/core/polkitqt1-subject.cpp
|
|
+++ b/core/polkitqt1-subject.cpp
|
|
@@ -58,6 +58,10 @@
|
|
{
|
|
g_type_init();
|
|
d->subject = subject;
|
|
+
|
|
+ if (d->subject != NULL) {
|
|
+ g_object_ref(d->subject);
|
|
+ }
|
|
}
|
|
|
|
Subject::Subject(const PolkitQt1::Subject& other)
|
|
@@ -88,6 +92,9 @@
|
|
|
|
void Subject::setSubject(PolkitSubject *subject)
|
|
{
|
|
+ if (d->subject != NULL) {
|
|
+ g_object_unref(d->subject);
|
|
+ }
|
|
d->subject = subject;
|
|
}
|
|
|
|
|