Important: Please read the Qt Code of Conduct -

Delayed slot execution closes wrong http connection

  • Hi all,
    We're running a simple Qt WebKit browser on a board which gets relatively busy at times. We're using Qt 4.8.6 sources crosscompiled for Arm.
    Sometimes the browser gets stuck loading the start page because one of the resources would fail to load.
    After instrumenting the code I've found out the following:

    In /src/network/access/qhttpnetworkconnectionchannel.cpp:
    Slot void QHttpNetworkConnectionChannel::_q_disconnected()
    sometimes gets executed when the connection object has already been reused for a new request. This abrutply terminates new request and closes underlying socket which explains why sometimes the page wont load waiting on a file.

    This is how slot linked to the event in the library source:
    QObject::connect(socket, SIGNAL(disconnected()),
    this, SLOT(_q_disconnected()),

    Qt::QueuedConnection suggests the slot will be executed sometime later. This on our busy board apparently causes the problem above.

    When I change it to Qt::DirectConnection so that the slot executed immediately after event it fixes our problem.

    Has anyone else had similar issues?
    Are there any implications or reasons I must not use Qt::DirectConnection for this particular slot?