[polkit-qt] pull in some more upstream fixes (from mbriza)

Rex Dieter rdieter at fedoraproject.org
Thu Dec 19 20:14:11 UTC 2013


commit 37c75377544ae303072e177ff6b54ac806d0db7b
Author: Rex Dieter <rdieter at math.unl.edu>
Date:   Thu Dec 19 14:14:22 2013 -0600

    pull in some more upstream fixes (from mbriza)

 ...FindGObject.cmake-with-the-one-in-kdelibs.patch |    4 +-
 0002-Normalize-connect-using-Qt-s-normalize.patch  |    4 +-
 0003-Fixed-reference-counting-of-GObjects.patch    |  105 ++++++++++++++++++++
 ...GCancellable-handling-in-PolkitQtListener.patch |   47 +++++++++
 polkit-qt.spec                                     |    9 ++-
 5 files changed, 164 insertions(+), 5 deletions(-)
---
diff --git a/0001-Sync-FindGObject.cmake-with-the-one-in-kdelibs.patch b/0001-Sync-FindGObject.cmake-with-the-one-in-kdelibs.patch
index 9a28684..e539616 100644
--- a/0001-Sync-FindGObject.cmake-with-the-one-in-kdelibs.patch
+++ b/0001-Sync-FindGObject.cmake-with-the-one-in-kdelibs.patch
@@ -1,7 +1,7 @@
 From 56883bddb1d1cf784a0c4e81da6232cddee62562 Mon Sep 17 00:00:00 2001
 From: Raphael Kubo da Costa <rakuco at FreeBSD.org>
 Date: Fri, 30 Dec 2011 21:14:36 -0200
-Subject: [PATCH 1/2] Sync FindGObject.cmake with the one in kdelibs.
+Subject: [PATCH 1/4] Sync FindGObject.cmake with the one in kdelibs.
 
 Import kdelibs' FindGObject.cmake at commit
 e02cae5112ef7ec37d6af3553399a136726b5288.
@@ -128,5 +128,5 @@ index 79a2127..af0c9f7 100644
 -MARK_AS_ADVANCED(GOBJECT_INCLUDE_DIR GOBJECT_LIBRARIES)
 +MARK_AS_ADVANCED(GOBJECT_INCLUDE_DIR _GObjectLibs _GModuleLibs _GThreadLibs _GLibs)
 -- 
-1.8.1.4
+1.8.4.2
 
diff --git a/0002-Normalize-connect-using-Qt-s-normalize.patch b/0002-Normalize-connect-using-Qt-s-normalize.patch
index 0c8a866..1111e17 100644
--- a/0002-Normalize-connect-using-Qt-s-normalize.patch
+++ b/0002-Normalize-connect-using-Qt-s-normalize.patch
@@ -1,7 +1,7 @@
 From 5d3fdc79b2b47f21f09351e16f677d55c1907f13 Mon Sep 17 00:00:00 2001
 From: Dario Freddi <drf at kde.org>
 Date: Mon, 30 Jan 2012 02:44:08 +0100
-Subject: [PATCH 2/2] Normalize connect() using Qt's normalize
+Subject: [PATCH 2/4] Normalize connect() using Qt's normalize
 
 ---
  core/polkitqt1-authority.cpp |  2 +-
@@ -112,5 +112,5 @@ index 32bfb98..e229899 100644
          connect(session, SIGNAL(showError(QString)), this, SLOT(showError(QString)));
          connect(session, SIGNAL(showInfo(QString)), this, SLOT(showInfo(QString)));
 -- 
-1.8.1.4
+1.8.4.2
 
diff --git a/0003-Fixed-reference-counting-of-GObjects.patch b/0003-Fixed-reference-counting-of-GObjects.patch
new file mode 100644
index 0000000..ad86ce6
--- /dev/null
+++ b/0003-Fixed-reference-counting-of-GObjects.patch
@@ -0,0 +1,105 @@
+From 4ed9c3fa043b70ee50176c4baacc07d1c73f1fce Mon Sep 17 00:00:00 2001
+From: Martin Briza <mbriza at redhat.com>
+Date: Fri, 22 Mar 2013 15:52:52 +0100
+Subject: [PATCH 3/4] 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
+---
+ agent/polkitqt1-agent-listener.cpp |  4 ++++
+ agent/polkitqt1-agent-session.cpp  |  3 +++
+ core/polkitqt1-details.cpp         | 12 ++++++++++--
+ core/polkitqt1-subject.cpp         |  7 +++++++
+ 4 files changed, 24 insertions(+), 2 deletions(-)
+
+diff --git a/agent/polkitqt1-agent-listener.cpp b/agent/polkitqt1-agent-listener.cpp
+index 369dd75..394a92e 100644
+--- a/agent/polkitqt1-agent-listener.cpp
++++ b/agent/polkitqt1-agent-listener.cpp
+@@ -62,6 +62,10 @@ Listener::Listener(PolkitAgentListener *listener, QObject *parent)
+     g_type_init();
+ 
+     d->listener = listener;
++    
++    if (d->listener != NULL) {
++        g_object_ref(d->listener);
++    }
+ }
+ 
+ Listener::~Listener()
+diff --git a/agent/polkitqt1-agent-session.cpp b/agent/polkitqt1-agent-session.cpp
+index 52ddacf..0aca92e 100644
+--- a/agent/polkitqt1-agent-session.cpp
++++ b/agent/polkitqt1-agent-session.cpp
+@@ -66,6 +66,9 @@ Session::Session(PolkitAgentSession *pkAgentSession, QObject *parent)
+         , 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);
+diff --git a/core/polkitqt1-details.cpp b/core/polkitqt1-details.cpp
+index e1d0f31..36abbfa 100644
+--- a/core/polkitqt1-details.cpp
++++ b/core/polkitqt1-details.cpp
+@@ -35,11 +35,15 @@ public:
+         : 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 @@ Details::Details(PolkitDetails *pkDetails)
+ {
+     g_type_init();
+     d->polkitDetails = pkDetails;
++    
++    if (d->polkitDetails != NULL) {
++        g_object_ref(d->polkitDetails);
++    }
+ }
+ 
+ Details::~Details()
+diff --git a/core/polkitqt1-subject.cpp b/core/polkitqt1-subject.cpp
+index dfc9697..b8738df 100644
+--- a/core/polkitqt1-subject.cpp
++++ b/core/polkitqt1-subject.cpp
+@@ -58,6 +58,10 @@ Subject::Subject(PolkitSubject *subject)
+ {
+     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 @@ PolkitSubject *Subject::subject() const
+ 
+ void Subject::setSubject(PolkitSubject *subject)
+ {
++    if (d->subject != NULL) {
++        g_object_unref(d->subject);
++    }
+     d->subject = subject;
+ }
+ 
+-- 
+1.8.4.2
+
diff --git a/0004-Fixed-GCancellable-handling-in-PolkitQtListener.patch b/0004-Fixed-GCancellable-handling-in-PolkitQtListener.patch
new file mode 100644
index 0000000..8a95607
--- /dev/null
+++ b/0004-Fixed-GCancellable-handling-in-PolkitQtListener.patch
@@ -0,0 +1,47 @@
+From 57a81d0c90fc509fd197b30378cc0ada3b7afbf1 Mon Sep 17 00:00:00 2001
+From: Martin Briza <m at rtinbriza.cz>
+Date: Fri, 12 Jul 2013 15:37:05 +0200
+Subject: [PATCH 4/4] Fixed GCancellable handling in PolkitQtListener
+
+There was a race condition happening on two simultanneous requests to the agent, causing it to crash.
+
+BUGS: 270489
+---
+ agent/polkitqtlistener.cpp | 14 +++++++-------
+ 1 file changed, 7 insertions(+), 7 deletions(-)
+
+diff --git a/agent/polkitqtlistener.cpp b/agent/polkitqtlistener.cpp
+index a9a93aa..dc5fdda 100644
+--- a/agent/polkitqtlistener.cpp
++++ b/agent/polkitqtlistener.cpp
+@@ -115,6 +115,13 @@ static void polkit_qt_listener_initiate_authentication(PolkitAgentListener  *age
+     qDebug() << "Listener adapter polkit_qt_listener_initiate_authentication";
+     PolkitQtListener *listener = POLKIT_QT_LISTENER(agent_listener);
+ 
++    if (cancellable != NULL) {
++        g_cancellable_connect(cancellable,
++                              G_CALLBACK(cancelled_cb),
++                              agent_listener,
++                              NULL);
++    }
++
+     // The result of asynchronous method will be created here and it will be pushed to the listener.
+     GSimpleAsyncResult *result = g_simple_async_result_new((GObject *) listener, callback, user_data, agent_listener);
+     qDebug() << "GSimpleAsyncResult:" << result;
+@@ -129,13 +136,6 @@ static void polkit_qt_listener_initiate_authentication(PolkitAgentListener  *age
+             cancellable,
+             result);
+ 
+-    if (cancellable != NULL) {
+-        g_signal_connect(cancellable,
+-                         "cancelled",
+-                         G_CALLBACK(cancelled_cb),
+-                         agent_listener);
+-    }
+-
+ }
+ 
+ static gboolean polkit_qt_listener_initiate_authentication_finish(PolkitAgentListener  *listener,
+-- 
+1.8.4.2
+
diff --git a/polkit-qt.spec b/polkit-qt.spec
index ed73696..1b45016 100644
--- a/polkit-qt.spec
+++ b/polkit-qt.spec
@@ -1,6 +1,6 @@
 Name:            polkit-qt
 Version:         0.103.0
-Release:         8%{?dist}
+Release:         9%{?dist}
 Summary:         Qt bindings for PolicyKit
 
 License:         GPLv2+
@@ -13,6 +13,8 @@ Patch0:          polkit-qt-0.95.1-install-cmake-find.patch
 ## upstream patches
 Patch101: 0001-Sync-FindGObject.cmake-with-the-one-in-kdelibs.patch
 Patch102: 0002-Normalize-connect-using-Qt-s-normalize.patch
+Patch103: 0003-Fixed-reference-counting-of-GObjects.patch
+Patch104: 0004-Fixed-GCancellable-handling-in-PolkitQtListener.patch
 
 Source10: macros.polkit-qt
 
@@ -55,6 +57,8 @@ BuildArch: noarch
 
 %patch101 -p1 -b .0001
 %patch102 -p1 -b .0002
+%patch103 -p1 -b .0003
+%patch104 -p1 -b .0004
 
 
 %build
@@ -107,6 +111,9 @@ install -p -m644 -D %{SOURCE10} %{buildroot}%{_sysconfdir}/rpm/macros.polkit-qt
 
 
 %changelog
+* Thu Dec 19 2013 Rex Dieter <rdieter at fedoraproject.org> 0.103.0-9
+- pull in some more upstream fixes (from mbriza)
+
 * Sun Aug 04 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.103.0-8
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
 


More information about the scm-commits mailing list