diff -ur polkit-qt-1-0.96.1/agent/polkitqt1-agent-listener.cpp polkit-qt-1-0.96.1_new/agent/polkitqt1-agent-listener.cpp --- polkit-qt-1-0.96.1/agent/polkitqt1-agent-listener.cpp 2010-10-15 21:30:06.295018901 +0200 +++ polkit-qt-1-0.96.1_new/agent/polkitqt1-agent-listener.cpp 2010-10-15 21:22:34.102034730 +0200 @@ -39,6 +39,7 @@ { public: PolkitAgentListener *listener; + void *registeredHandle; }; Listener::Listener(QObject *parent) @@ -66,6 +67,8 @@ qDebug("Destroying listener"); ListenerAdapter::instance()->removeListener(this); + if (d->registeredHandle) + polkit_agent_listener_unregister(d->registeredHandle); if (d->listener != NULL) g_object_unref(d->listener); } @@ -73,17 +76,24 @@ bool Listener::registerListener(PolkitQt1::Subject *subject, const QString &objectPath) { GError *error = NULL; - - bool r = polkit_agent_register_listener(d->listener, + d->registeredHandle = polkit_agent_listener_register(d->listener, + POLKIT_AGENT_REGISTER_FLAGS_NONE, subject->subject(), objectPath.toAscii().data(), + NULL, &error); + if (error != NULL) { qWarning() << QString("Cannot register authentication agent: %1").arg(error->message); g_error_free(error); return false; } - return r; + if (d->registeredHandle == NULL) + { + qWarning() << QString("Cannot register authentication agent!"); + return false; + } + return true; } const PolkitAgentListener *Listener::listener() diff -ur polkit-qt-1-0.96.1/core/polkitqt1-authority.cpp polkit-qt-1-0.96.1_new/core/polkitqt1-authority.cpp --- polkit-qt-1-0.96.1/core/polkitqt1-authority.cpp 2010-07-03 12:17:13.000000000 +0200 +++ polkit-qt-1-0.96.1_new/core/polkitqt1-authority.cpp 2010-10-15 15:21:47.396705581 +0200 @@ -177,12 +177,17 @@ m_revokeTemporaryAuthorizationsCancellable = g_cancellable_new(); m_revokeTemporaryAuthorizationCancellable = g_cancellable_new(); + GError *gerror = NULL; if (pkAuthority == NULL) { - pkAuthority = polkit_authority_get(); + pkAuthority = polkit_authority_get_sync(NULL, &gerror); + if (gerror != NULL) { + setError(E_GetAuthority, gerror->message); + g_error_free(gerror); + return; + } } if (pkAuthority == NULL) { - (E_GetAuthority); return; }