polkit-qt5-1/fixed-GCancellable-handling-in-PolkitQtListener.patch

45 lines
1.5 KiB
Diff

From: Martin Briza <m@rtinbriza.cz>
Date: Fri, 12 Jul 2013 13:37:05 +0000
Subject: Fixed GCancellable handling in PolkitQtListener
X-Git-Url: http://quickgit.kde.org/?p=polkit-qt-1.git&a=commitdiff&h=57a81d0c90fc509fd197b30378cc0ada3b7afbf1
---
Fixed GCancellable handling in PolkitQtListener
There was a race condition happening on two simultanneous requests to the agent, causing it to crash.
BUGS: 270489
---
--- a/agent/polkitqtlistener.cpp
+++ b/agent/polkitqtlistener.cpp
@@ -115,6 +115,13 @@
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 @@
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,