Commit 5205232f authored by David Faure's avatar David Faure
Browse files

Fix DBus timeout when kbuilsycoca takes too much time to run

... or when a kuniqueapplication takes time to start.

This should fix a large number of bugs where ksycoca code crashes
due to not waiting enough for kbuildsycoca.

I'll also get a patch into future versions of Qt to make the timeout
configurable in QDBusAbstractInterface, so that we don't have to port
all the possibly-long dbus calls to QDBusConnection like in this patch.

CCBUG: 211401
parent f1a5f040
......@@ -112,7 +112,7 @@ int KToolInvocation::startServiceInternal(const char *_function,
if( !function.startsWith( QLatin1String("kdeinit_exec") ) )
msg << noWait;
QDBusMessage reply = QDBusConnection::sessionBus().call(msg);
QDBusMessage reply = QDBusConnection::sessionBus().call(msg, QDBus::Block, INT_MAX);
if ( reply.type() != QDBusMessage::ReplyMessage )
{
QDBusReply<QString> replyObj(reply);
......
......@@ -287,11 +287,14 @@ KUniqueApplication::start(StartFlags flags)
new_asn_id = id.id();
#endif
QDBusInterface iface(appName, "/MainApplication", "org.kde.KUniqueApplication", QDBusConnection::sessionBus());
QDBusReply<int> reply;
if (!iface.isValid() || !(reply = iface.call("newInstance", new_asn_id, saved_args)).isValid())
QDBusMessage msg = QDBusMessage::createMethodCall(appName, "/MainApplication", "org.kde.KUniqueApplication",
"newInstance");
msg << new_asn_id << saved_args;
QDBusReply<int> reply = QDBusConnection::sessionBus().call(msg, QDBus::Block, INT_MAX);
if (!reply.isValid())
{
QDBusError err = iface.lastError();
QDBusError err = reply.error();
kError() << "Communication problem with " << KCmdLineArgs::aboutData()->appName() << ", it probably crashed." << endl
<< "Error message was: " << err.name() << ": \"" << err.message() << "\"" << endl;
::exit(255);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment