mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-23 18:32:49 +00:00
kdecore: do not call the helper asynchronously from KAuthorization::execute()
racy-racy.. Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
85d6590693
commit
5cd906e4f9
2 changed files with 4 additions and 7 deletions
|
@ -37,6 +37,7 @@
|
|||
|
||||
// see kdebug.areas
|
||||
static const int s_kauthorizationarea = 185;
|
||||
static const qint64 s_servicetimeout = 30000;
|
||||
|
||||
void kAuthMessageHandler(QtMsgType type, const char *msg)
|
||||
{
|
||||
|
@ -160,12 +161,7 @@ int KAuthorization::execute(const QString &helper, const QString &method, const
|
|||
helper, QString::fromLatin1("/KAuthorization"), QString::fromLatin1("org.kde.kauthorization"),
|
||||
QDBusConnection::systemBus()
|
||||
);
|
||||
QDBusPendingReply<int> reply = kauthorizationinterface.asyncCall(QString::fromLatin1("execute"), method, arguments);
|
||||
kDebug(s_kauthorizationarea) << "Waiting for service call to finish" << helper;
|
||||
while (!reply.isFinished()) {
|
||||
QCoreApplication::processEvents(QEventLoop::AllEvents, KAUTHORIZATION_TIMEOUT);
|
||||
}
|
||||
kDebug(s_kauthorizationarea) << "Done waiting for service call to finish" << helper;
|
||||
QDBusReply<int> reply = kauthorizationinterface.call(QString::fromLatin1("execute"), method, arguments);
|
||||
int result = KAuthorization::NoError;
|
||||
if (!reply.isValid()) {
|
||||
result = KAuthorization::DBusError;
|
||||
|
@ -221,7 +217,7 @@ void KAuthorization::helperMain(const char* const helper, KAuthorization *object
|
|||
}
|
||||
|
||||
// in case the process executing the helper crashes
|
||||
QTimer::singleShot(30000, qApp, SLOT(quit()));
|
||||
QTimer::singleShot(s_servicetimeout, qApp, SLOT(quit()));
|
||||
}
|
||||
|
||||
#include "kauthorization.moc"
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
}
|
||||
@endcode
|
||||
|
||||
@warning the helper has failsafe - after 30sec it will exit unconditionally!
|
||||
@since 4.22
|
||||
*/
|
||||
class KDECORE_EXPORT KAuthorization : public QObject
|
||||
|
|
Loading…
Add table
Reference in a new issue